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


Groups > linux.kernel > #1660845

[PATCH v4 2/9] perf tools: Fix a memory leak in __open_dso()

From Namhyung Kim <namhyung@kernel.org>
Newsgroups linux.kernel
Subject [PATCH v4 2/9] perf tools: Fix a memory leak in __open_dso()
Date 2017-06-08 09:40 +0200
Message-ID <tQ0cW-1hd-25@gated-at.bofh.it> (permalink)
References <tQ0cV-1hd-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

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


Thread

[PATCH v4 2/9] perf tools: Fix a memory leak in __open_dso() Namhyung Kim <namhyung@kernel.org> - 2017-06-08 09:40 +0200
  [tip:perf/urgent] perf tools: Fix a memory leak in __open_dso() tip-bot for Namhyung Kim <tipbot@zytor.com> - 2017-06-09 01:00 +0200

csiph-web