[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170608073109.30699-3-namhyung@kernel.org>
Date: Thu, 8 Jun 2017 16:31:02 +0900
From: Namhyung Kim <namhyung@...nel.org>
To: Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: Ingo Molnar <mingo@...nel.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Jiri Olsa <jolsa@...nel.org>,
LKML <linux-kernel@...r.kernel.org>, kernel-team@....com,
David Ahern <dsahern@...il.com>,
Adrian Hunter <adrian.hunter@...el.com>,
Wang Nan <wangnan0@...wei.com>
Subject: [PATCH v4 2/9] perf tools: Fix a memory leak in __open_dso()
The name should be freed on error path.
Signed-off-by: Namhyung Kim <namhyung@...nel.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
Powered by blists - more mailing lists