btrfs-progs: handle errors in get_root_backref and fail in the caller

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2016-01-06 15:37:06 +01:00
parent 3823cc2771
commit f72a3f9f9f

View file

@ -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;