mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-16 00:34:20 +08:00
perf data: Force perf_data__open|close zero data->file.path
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@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Jonas Rabenstein <jonas.rabenstein@studium.uni-erlangen.de> Cc: Nageswara R Sastry <nasastry@in.ibm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Ravi Bangoria <ravi.bangoria@linux.ibm.com> Link: http://lkml.kernel.org/r/20190305152536.21035-9-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
befa09b61f
commit
b8f7d86b58
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user