[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1381372135-4408-1-git-send-email-felipensp@gmail.com>
Date: Wed, 9 Oct 2013 23:28:55 -0300
From: Felipe Pena <felipensp@...il.com>
To: Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Paul Mackerras <paulus@...ba.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...stprotocols.net>,
Namhyung Kim <namhyung@...nel.org>,
Borislav Petkov <bp@...e.de>
Cc: linux-kernel@...r.kernel.org, Felipe Pena <felipensp@...il.com>
Subject: [PATCH] tools/perf/util: Fix memory leak in trace-event-info.c
Fix for a memory leak on tracing_data_get() function when returning NULL explicitly
Signed-off-by: Felipe Pena <felipensp@...il.com>
---
tools/perf/util/trace-event-info.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c
index f3c9e55..06f8624 100644
--- a/tools/perf/util/trace-event-info.c
+++ b/tools/perf/util/trace-event-info.c
@@ -518,13 +518,13 @@ struct tracing_data *tracing_data_get(struct list_head *pattrs,
"/tmp/perf-XXXXXX");
if (!mkstemp(tdata->temp_file)) {
pr_debug("Can't make temp file");
- return NULL;
+ goto err_tdata;
}
temp_fd = open(tdata->temp_file, O_RDWR);
if (temp_fd < 0) {
pr_debug("Can't read '%s'", tdata->temp_file);
- return NULL;
+ goto err_tdata;
}
/*
@@ -569,6 +569,10 @@ out:
put_tracepoints_path(tps);
return tdata;
+
+err_tdata:
+ free(tdata);
+ return NULL;
}
int tracing_data_put(struct tracing_data *tdata)
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists