From a3ed81c5e93079cfe8100382e6e015fba76a7715 Mon Sep 17 00:00:00 2001 From: Stefan Behrens Date: Tue, 9 Apr 2013 19:08:32 +0200 Subject: Btrfs-progs: fix a small memory leak in btrfs-list.c valgrind found this very obvious issue. Signed-off-by: Stefan Behrens --- btrfs-list.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'btrfs-list.c') diff --git a/btrfs-list.c b/btrfs-list.c index a748d5e7..38e7e53b 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); -- cgit v1.2.3