mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-05 18:39:59 +00:00
perf tools: Cleanup trace-event-info 'tdata' leak
Free tracing_data structure in tracing_data_get() error paths. Fixes the following coverity complaint: Error: RESOURCE_LEAK (CWE-772): leaked_storage: Variable "tdata" going out of scope leaks the storage Signed-off-by: Sanskriti Sharma <sansharm@redhat.com> Reviewed-by: Jiri Olsa <jolsa@kernel.org> Cc: Joe Lawrence <joe.lawrence@redhat.com> Link: http://lkml.kernel.org/r/1538490554-8161-3-git-send-email-sansharm@redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
ce49d8436c
commit
faedbf3fd1
1 changed files with 2 additions and 0 deletions
|
@ -531,12 +531,14 @@ 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");
|
||||
free(tdata);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
temp_fd = open(tdata->temp_file, O_RDWR);
|
||||
if (temp_fd < 0) {
|
||||
pr_debug("Can't read '%s'", tdata->temp_file);
|
||||
free(tdata);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue