From: Gui Hecheng Date: Thu, 26 Jun 2014 02:53:04 +0000 (+0800) Subject: btrfs-progs: cleanup possible silent failure in btrfs-image X-Git-Tag: upstream/4.16.1~2775 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cc1c1eab1792db37593d4c840bfaef1e6af831d7;p=platform%2Fupstream%2Fbtrfs-progs.git 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 Signed-off-by: David Sterba --- diff --git a/btrfs-image.c b/btrfs-image.c index 1a460ba..b8e8c4d 100644 --- a/btrfs-image.c +++ b/btrfs-image.c @@ -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);