projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
befa09b
)
perf data: Force perf_data__open|close zero data->file.path
author
Jiri Olsa
<
[email protected]
>
Tue, 5 Mar 2019 15:25:36 +0000
(16:25 +0100)
committer
Arnaldo Carvalho de Melo
<
[email protected]
>
Wed, 6 Mar 2019 21:21:00 +0000
(18:21 -0300)
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 <
[email protected]
>
Cc: Alexander Shishkin <
[email protected]
>
Cc: Andi Kleen <
[email protected]
>
Cc: Jonas Rabenstein <
[email protected]
>
Cc: Nageswara R Sastry <
[email protected]
>
Cc: Namhyung Kim <
[email protected]
>
Cc: Peter Zijlstra <
[email protected]
>
Cc: Ravi Bangoria <
[email protected]
>
Link:
http://lkml.kernel.org/r/
[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <
[email protected]
>
tools/perf/util/data.c
patch
|
blob
|
history
diff --git
a/tools/perf/util/data.c
b/tools/perf/util/data.c
index 7bd5ddeb7a411595133d85728698b98fc6836359..e098e189f93e45e0217bb07758fab03f543a45c0 100644
(file)
--- 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);
}