mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-23 14:45:19 +00:00
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>
This commit is contained in:
parent
5d48302236
commit
40af8f4ae7
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user