btrfs-progs: handler memory allocation failure in add_extent_rec
authorDavid Sterba <dsterba@suse.com>
Wed, 6 Jan 2016 14:52:11 +0000 (15:52 +0100)
committerDavid Sterba <dsterba@suse.com>
Tue, 12 Jan 2016 14:02:51 +0000 (15:02 +0100)
Signed-off-by: David Sterba <dsterba@suse.com>
cmds-check.c

index 266451a894f7ccee5187fd11b716dec3845e7d30..e75165693a9b64336668389006c28cbd44d583e0 100644 (file)
@@ -4586,6 +4586,8 @@ static int add_extent_rec(struct cache_tree *extent_cache,
                return ret;
        }
        rec = malloc(sizeof(*rec));
+       if (!rec)
+               return -ENOMEM;
        rec->start = start;
        rec->max_size = max_size;
        rec->nr = max(nr, max_size);