[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190307174433.28819-36-acme@kernel.org>
Date: Thu, 7 Mar 2019 14:44:33 -0300
From: Arnaldo Carvalho de Melo <acme@...nel.org>
To: Ingo Molnar <mingo@...nel.org>
Cc: Jiri Olsa <jolsa@...nel.org>, Namhyung Kim <namhyung@...nel.org>,
Clark Williams <williams@...hat.com>,
linux-kernel@...r.kernel.org, linux-perf-users@...r.kernel.org,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Andi Kleen <ak@...ux.intel.com>,
Jonas Rabenstein <jonas.rabenstein@...dium.uni-erlangen.de>,
Nageswara R Sastry <nasastry@...ibm.com>,
Peter Zijlstra <peterz@...radead.org>,
Ravi Bangoria <ravi.bangoria@...ux.ibm.com>,
Arnaldo Carvalho de Melo <acme@...hat.com>
Subject: [PATCH 35/35] perf data: Force perf_data__open|close zero data->file.path
From: Jiri Olsa <jolsa@...nel.org>
Making sure the data->file.path is zeroed on perf_data__open error path
and in perf_data__close, so we don't double free it in case someone call
it twice.
Signed-off-by: Jiri Olsa <jolsa@...nel.org>
Cc: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
Cc: Andi Kleen <ak@...ux.intel.com>
Cc: Jonas Rabenstein <jonas.rabenstein@...dium.uni-erlangen.de>
Cc: Nageswara R Sastry <nasastry@...ibm.com>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Ravi Bangoria <ravi.bangoria@...ux.ibm.com>
Link: http://lkml.kernel.org/r/20190305152536.21035-9-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/perf/util/data.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/data.c b/tools/perf/util/data.c
index 7bd5ddeb7a41..e098e189f93e 100644
--- a/tools/perf/util/data.c
+++ b/tools/perf/util/data.c
@@ -237,7 +237,7 @@ static int open_file(struct perf_data *data)
open_file_read(data) : open_file_write(data);
if (fd < 0) {
- free(data->file.path);
+ zfree(&data->file.path);
return -1;
}
@@ -270,7 +270,7 @@ int perf_data__open(struct perf_data *data)
void perf_data__close(struct perf_data *data)
{
- free(data->file.path);
+ zfree(&data->file.path);
close(data->file.fd);
}
--
2.20.1
Powered by blists - more mailing lists