[PATCH 02/13] perf tools: Fix a memory leak in vmlinux_path__init()

From: Namhyung Kim
Date: Tue Aug 12 2014 - 02:44:31 EST


When uname() failed, it should free vmlinux_path.

Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
---
tools/perf/util/symbol.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 581c56836567..009a9d064f11 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -1772,7 +1772,7 @@ static int vmlinux_path__init(void)
return 0;

if (uname(&uts) < 0)
- return -1;
+ goto out_fail;

snprintf(bf, sizeof(bf), "/boot/vmlinux-%s", uts.release);
vmlinux_path[vmlinux_path__nr_entries] = strdup(bf);
--
2.0.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/