summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2017-06-08 10:31:02 +0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2017-06-08 21:38:47 +0300
commit44ad6b8852529eb39066edbedc027a6901da6803 (patch)
treeb21fa536818dd709a241f83820a5c8b566d692ca /tools
parent3619ef76b37d4803bc9daee9d03d82c8526db378 (diff)
downloadlinux-44ad6b8852529eb39066edbedc027a6901da6803.tar.xz
perf tools: Fix a memory leak in __open_dso()
The 'name' variable should be freed on the error path. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Jiri Olsa <jolsa@kernel.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Wang Nan <wangnan0@huawei.com> Cc: kernel-team@lge.com Link: http://lkml.kernel.org/r/20170608073109.30699-3-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/dso.c4
1 files changed, 3 insertions, 1 deletions
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);