Commit 2e8e70e56265496274e0c19464fffe896009bfc0
Committed by
Greg Kroah-Hartman
1 parent
52ff94ce51
Exists in
smarc_8mm_imx_4.14.98_2.0.0_ga
and in
4 other branches
perf tools: Cleanup trace-event-info 'tdata' leak
[ Upstream commit faedbf3fd19f2511a39397f76359e4cc6ee93072 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Showing 1 changed file with 2 additions and 0 deletions Side-by-side Diff
tools/perf/util/trace-event-info.c
... | ... | @@ -533,12 +533,14 @@ |
533 | 533 | "/tmp/perf-XXXXXX"); |
534 | 534 | if (!mkstemp(tdata->temp_file)) { |
535 | 535 | pr_debug("Can't make temp file"); |
536 | + free(tdata); | |
536 | 537 | return NULL; |
537 | 538 | } |
538 | 539 | |
539 | 540 | temp_fd = open(tdata->temp_file, O_RDWR); |
540 | 541 | if (temp_fd < 0) { |
541 | 542 | pr_debug("Can't read '%s'", tdata->temp_file); |
543 | + free(tdata); | |
542 | 544 | return NULL; |
543 | 545 | } |
544 | 546 |