Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1661750

[PATCH 08/15] perf tools: Fix a memory leak in __open_dso()

From Arnaldo Carvalho de Melo <acme@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 08/15] perf tools: Fix a memory leak in __open_dso()
Date 2017-06-09 00:10 +0200
Message-ID <tQdMT-1yv-41@gated-at.bofh.it> (permalink)
References <tQdMR-1yv-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Namhyung Kim <namhyung@kernel.org>

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>
---
 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.9.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[GIT PULL 00/15] perf/urgent fixes Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-06-09 00:10 +0200
  [PATCH 02/15] perf script: Fix outdated comment for perf-trace-python Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-06-09 00:10 +0200
  [PATCH 14/15] perf symbols: Keep DSO->symtab_type after decompress Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-06-09 00:10 +0200
  [PATCH 07/15] perf annotate: Fix symbolic link of build-id cache Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-06-09 00:10 +0200
  [PATCH 15/15] perf symbols: Kill dso__build_id_is_kmod() Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-06-09 00:10 +0200
  [PATCH 08/15] perf tools: Fix a memory leak in __open_dso() Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-06-09 00:10 +0200
  [PATCH 10/15] perf annotate: Use dso__decompress_kmodule_path() Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-06-09 00:10 +0200
  Re: [GIT PULL 00/15] perf/urgent fixes Ingo Molnar <mingo@kernel.org> - 2017-06-09 00:50 +0200

csiph-web