From: Kenji Okimoto Date: Thu, 15 Nov 2012 04:47:51 +0000 (+0900) Subject: btrfs-progs: check malloc() result X-Git-Tag: upstream/4.16.1~3472 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1cce8d72f2d0d00bd5c9322b16176de0fb56aff6;p=platform%2Fupstream%2Fbtrfs-progs.git btrfs-progs: check malloc() result Signed-off-by: Kenji Okimoto --- diff --git a/disk-io.c b/disk-io.c index 32f45dc..c4d4631 100644 --- a/disk-io.c +++ b/disk-io.c @@ -458,6 +458,9 @@ static int find_and_setup_log_root(struct btrfs_root *tree_root, u64 blocknr = btrfs_super_log_root(disk_super); struct btrfs_root *log_root = malloc(sizeof(struct btrfs_root)); + if (!log_root) + return -ENOMEM; + if (blocknr == 0) { free(log_root); return 0;