summaryrefslogtreecommitdiff
path: root/cmds-filesystem.c
diff options
context:
space:
mode:
authorRakesh Pandit <rakesh@tuxera.com>2014-03-15 13:46:15 +0200
committerChris Mason <clm@fb.com>2014-03-21 09:51:31 -0700
commit40af8f4ae778dd311a059db6cbfa52bb930fd052 (patch)
tree0300dc41fbce12ab52b8917c016fb371f592a505 /cmds-filesystem.c
parent5d483022363254229afff73f79ecd6dd19910dab (diff)
Btrfs-progs: return with -ENOMEM if malloc fails
Prevent segfault if memory allocation fails for sargs in get_df (cmds-filesystem.c). Signed-off-by: Rakesh Pandit <rakesh@tuxera.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'cmds-filesystem.c')
-rw-r--r--cmds-filesystem.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/cmds-filesystem.c b/cmds-filesystem.c
index fbf2e10b..bd9ba667 100644
--- a/cmds-filesystem.c
+++ b/cmds-filesystem.c
@@ -188,7 +188,7 @@ static int get_df(int fd, struct btrfs_ioctl_space_args **sargs_ret)
sargs = malloc(sizeof(struct btrfs_ioctl_space_args) +
(count * sizeof(struct btrfs_ioctl_space_info)));
if (!sargs)
- ret = -ENOMEM;
+ return -ENOMEM;
sargs->space_slots = count;
sargs->total_spaces = 0;