btrfs-progs: check: free memory on failure in get_inode_rec()
Free the newly allocated structures when 'mod' is requests and insertion fails. All exit paths from the function now don't leave anything to clean up. Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
054b314fbe
commit
8591711afb
|
@ -776,8 +776,11 @@ static struct inode_record *get_inode_rec(struct cache_tree *inode_cache,
|
|||
rec->found_link = 1;
|
||||
|
||||
ret = insert_cache_extent(inode_cache, &node->cache);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
free(rec);
|
||||
free(node);
|
||||
return ERR_PTR(-EEXIST);
|
||||
}
|
||||
}
|
||||
return rec;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue