diff options
author | Stefan Behrens <sbehrens@giantdisaster.de> | 2013-04-09 19:08:32 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.cz> | 2013-04-23 18:56:22 +0200 |
commit | a3ed81c5e93079cfe8100382e6e015fba76a7715 (patch) | |
tree | 289b45678ad3265908b06ff00db6f422ca501936 | |
parent | 75c47053a44e77126faa67c93e2833887e4cf21e (diff) | |
download | btrfs-progs-a3ed81c5e93079cfe8100382e6e015fba76a7715.tar.gz |
Btrfs-progs: fix a small memory leak in btrfs-list.c
valgrind found this very obvious issue.
Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
-rw-r--r-- | btrfs-list.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/btrfs-list.c b/btrfs-list.c index a748d5e..38e7e53 100644 --- a/btrfs-list.c +++ b/btrfs-list.c @@ -577,13 +577,13 @@ static int resolve_root(struct root_lookup *rl, struct root_info *ri, add_len = strlen(found->path); - /* room for / and for null */ - tmp = malloc(add_len + 2 + len); - if (!tmp) { - perror("malloc failed"); - exit(1); - } if (full_path) { + /* room for / and for null */ + tmp = malloc(add_len + 2 + len); + if (!tmp) { + perror("malloc failed"); + exit(1); + } memcpy(tmp + add_len + 1, full_path, len); tmp[add_len] = '/'; memcpy(tmp, found->path, add_len); |