lkml.org 
[lkml]   [2017]   [Jun]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v4 2/9] perf tools: Fix a memory leak in __open_dso()
Date
The name should be freed on error path.

Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
tools/perf/util/dso.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c
index b27d127cdf68..1f29e4fe7af0 100644
--- a/tools/perf/util/dso.c
+++ b/tools/perf/util/dso.c
@@ -412,8 +412,10 @@ static int __open_dso(struct dso *dso, struct machine *machine)
return -EINVAL;
}

- if (!is_regular_file(name))
+ if (!is_regular_file(name)) {
+ free(name);
return -EINVAL;
+ }

fd = do_open(name);
free(name);
--
2.13.1
\
 
 \ /
  Last update: 2017-06-12 01:23    [W:0.099 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site