diff options
author | David Sterba <dsterba@suse.com> | 2016-01-06 15:37:06 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-01-12 15:01:08 +0100 |
commit | f72a3f9f9ff04d29ccee7f6355b78a1291ee42af (patch) | |
tree | 912a82435db34f27e5ab48a8d16220e1ceb3329f /cmds-check.c | |
parent | 3823cc2771cc55a8ca4c4266192f1c5a973d1fcd (diff) | |
download | btrfs-progs-f72a3f9f9ff04d29ccee7f6355b78a1291ee42af.tar.gz |
btrfs-progs: handle errors in get_root_backref and fail in the caller
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'cmds-check.c')
-rw-r--r-- | cmds-check.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/cmds-check.c b/cmds-check.c index c8cea4f..cb48b79 100644 --- a/cmds-check.c +++ b/cmds-check.c @@ -3070,6 +3070,8 @@ static struct root_backref *get_root_backref(struct root_record *rec, } backref = calloc(1, sizeof(*backref) + namelen + 1); + if (!backref) + return NULL; backref->ref_root = ref_root; backref->dir = dir; backref->index = index; @@ -3109,6 +3111,7 @@ static int add_root_backref(struct cache_tree *root_cache, rec = get_root_rec(root_cache, root_id); BUG_ON(IS_ERR(rec)); backref = get_root_backref(rec, ref_root, dir, index, name, namelen); + BUG_ON(!backref); backref->errors |= errors; |