diff options
author | Eric Sandeen <sandeen@redhat.com> | 2013-02-25 16:54:47 -0600 |
---|---|---|
committer | David Sterba <dsterba@suse.cz> | 2013-02-27 14:39:59 +0100 |
commit | a9df6a1bdef4a495552a6200efdba065957a7183 (patch) | |
tree | e82170eb4ab374990ecd61cbb36c33db6134b6aa /btrfs-list.c | |
parent | e54ba43cdedcd8754c5f6036db21bb379e0914b9 (diff) |
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>
Diffstat (limited to 'btrfs-list.c')
-rw-r--r-- | btrfs-list.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/btrfs-list.c b/btrfs-list.c index 851c059e..8c3f84de 100644 --- a/btrfs-list.c +++ b/btrfs-list.c @@ -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; |