Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Sanskriti Sharma and committed by
Arnaldo Carvalho de Melo
faedbf3f ce49d843

+2
+2
tools/perf/util/trace-event-info.c
··· 531 531 "/tmp/perf-XXXXXX"); 532 532 if (!mkstemp(tdata->temp_file)) { 533 533 pr_debug("Can't make temp file"); 534 + free(tdata); 534 535 return NULL; 535 536 } 536 537 537 538 temp_fd = open(tdata->temp_file, O_RDWR); 538 539 if (temp_fd < 0) { 539 540 pr_debug("Can't read '%s'", tdata->temp_file); 541 + free(tdata); 540 542 return NULL; 541 543 } 542 544