From f72a3f9f9ff04d29ccee7f6355b78a1291ee42af Mon Sep 17 00:00:00 2001 From: David Sterba Date: Wed, 6 Jan 2016 15:37:06 +0100 Subject: btrfs-progs: handle errors in get_root_backref and fail in the caller Signed-off-by: David Sterba --- cmds-check.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'cmds-check.c') 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; -- cgit v1.2.1