]> Git Repo - linux.git/commitdiff
perf data: Force perf_data__open|close zero data->file.path
authorJiri Olsa <[email protected]>
Tue, 5 Mar 2019 15:25:36 +0000 (16:25 +0100)
committerArnaldo 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

index 7bd5ddeb7a411595133d85728698b98fc6836359..e098e189f93e45e0217bb07758fab03f543a45c0 100644 (file)
@@ -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);
 }
 
This page took 0.130057 seconds and 4 git commands to generate.