mirror of
https://github.com/kdave/btrfs-progs
synced 2025-04-24 20:17:57 +00:00
btrfs-progs: fix mem leak in resolve_root
If we exit with error we must free the allocated memory to avoid a leak. Signed-off-by: Eric Sandeen <sandeen@redhat.com>
This commit is contained in:
parent
e54ba43cde
commit
a9df6a1bde
@ -568,8 +568,10 @@ static int resolve_root(struct root_lookup *rl, struct root_info *ri,
|
||||
* ref_tree = 0 indicates the subvolumes
|
||||
* has been deleted.
|
||||
*/
|
||||
if (!found->ref_tree)
|
||||
if (!found->ref_tree) {
|
||||
free(full_path);
|
||||
return -ENOENT;
|
||||
}
|
||||
int add_len = strlen(found->path);
|
||||
|
||||
/* room for / and for null */
|
||||
@ -612,8 +614,10 @@ static int resolve_root(struct root_lookup *rl, struct root_info *ri,
|
||||
* subvolume was deleted.
|
||||
*/
|
||||
found = root_tree_search(rl, next);
|
||||
if (!found)
|
||||
if (!found) {
|
||||
free(full_path);
|
||||
return -ENOENT;
|
||||
}
|
||||
}
|
||||
|
||||
ri->full_path = full_path;
|
||||
|
Loading…
Reference in New Issue
Block a user