diff options
author | David Sterba <dsterba@suse.com> | 2024-03-16 19:21:43 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2024-03-16 23:14:02 +0100 |
commit | 8591711afb6fc2ff120b63f72596154478423182 (patch) | |
tree | 9a0f9855f029abd8cac06494df924667a381ff24 | |
parent | 054b314fbe5efc8b115a18bd93dfea52d15ea607 (diff) | |
download | btrfs-progs-8591711afb6fc2ff120b63f72596154478423182.tar.gz |
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>
-rw-r--r-- | check/main.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/check/main.c b/check/main.c index a7439d61..c29ce7c8 100644 --- a/check/main.c +++ b/check/main.c @@ -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; } |