linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tools: perf: builtin-trace.c:  Cleaning up memory leak
@ 2014-06-01 11:38 Rickard Strandqvist
  2014-06-03  3:14 ` Namhyung Kim
  0 siblings, 1 reply; 2+ messages in thread
From: Rickard Strandqvist @ 2014-06-01 11:38 UTC (permalink / raw)
  To: Peter Zijlstra, Paul Mackerras
  Cc: Rickard Strandqvist, Ingo Molnar, Arnaldo Carvalho de Melo, linux-kernel

There is a risk for memory leak in when something unexpected happens
and the function returns.

This was largely found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
---
 tools/perf/builtin-trace.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index f954c26..e6b3df9 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -1855,6 +1855,7 @@ static int trace__record(int argc, const char **argv)
 		rec_argv[i] = "syscalls:sys_enter,syscalls:sys_exit";
 	else {
 		pr_err("Neither raw_syscalls nor syscalls events exist.\n");
+		free(rec_argv);
 		return -1;
 	}
 	i++;
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] tools: perf: builtin-trace.c:  Cleaning up memory leak
  2014-06-01 11:38 [PATCH] tools: perf: builtin-trace.c: Cleaning up memory leak Rickard Strandqvist
@ 2014-06-03  3:14 ` Namhyung Kim
  0 siblings, 0 replies; 2+ messages in thread
From: Namhyung Kim @ 2014-06-03  3:14 UTC (permalink / raw)
  To: Rickard Strandqvist
  Cc: Peter Zijlstra, Paul Mackerras, Ingo Molnar,
	Arnaldo Carvalho de Melo, linux-kernel

On Sun,  1 Jun 2014 13:38:26 +0200, Rickard Strandqvist wrote:
> There is a risk for memory leak in when something unexpected happens
> and the function returns.
>
> This was largely found by using a static code analysis program called cppcheck.

Acked-by: Namhyung Kim <namhyung@kernel.org>

Thanks,
Namhyung

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-06-03  3:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-01 11:38 [PATCH] tools: perf: builtin-trace.c: Cleaning up memory leak Rickard Strandqvist
2014-06-03  3:14 ` Namhyung Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).