btrfs-progs: cleanup possible silent failure in btrfs-image

If the malloc above fails, the btrfs-image will exit directly
without any error messages.
Now just return the ENOMEM errno and let the caller prompt the
error message.

Signed-off-by: Gui Hecheng <guihc.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
This commit is contained in:
Gui Hecheng 2014-06-26 10:53:04 +08:00 committed by David Sterba
parent aada050961
commit cc1c1eab17

View File

@ -2421,7 +2421,8 @@ static int update_disk_super_on_device(struct btrfs_fs_info *info,
buf = malloc(BTRFS_SUPER_INFO_SIZE);
if (!buf) {
ret = -ENOMEM;
exit(1);
close(fp);
return ret;
}
memcpy(buf, info->super_copy, BTRFS_SUPER_INFO_SIZE);