summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2016-01-06 15:08:46 +0100
committerDavid Sterba <dsterba@suse.com>2016-01-12 15:01:09 +0100
commitb317ca97d3f6c2b2ef23b051d304c7f03e3c23f1 (patch)
treed4ef11e763ac991a48f4f73276f856ab3c2af1ad
parentf72a3f9f9ff04d29ccee7f6355b78a1291ee42af (diff)
btrfs-progs: handle errors in get_inode_backref and fail in the caller
Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r--cmds-check.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/cmds-check.c b/cmds-check.c
index cb48b795..224bec06 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -952,6 +952,8 @@ static struct inode_backref *get_inode_backref(struct inode_record *rec,
}
backref = malloc(sizeof(*backref) + namelen + 1);
+ if (!backref)
+ return NULL;
memset(backref, 0, sizeof(*backref));
backref->dir = dir;
backref->namelen = namelen;
@@ -972,6 +974,7 @@ static int add_inode_backref(struct cache_tree *inode_cache,
rec = get_inode_rec(inode_cache, ino, 1);
BUG_ON(IS_ERR(rec));
backref = get_inode_backref(rec, name, namelen, dir);
+ BUG_ON(!backref);
if (errors)
backref->errors |= errors;
if (itemtype == BTRFS_DIR_INDEX_KEY) {