diff options
author | Sanskriti Sharma <sansharm@redhat.com> | 2018-10-02 10:29:11 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-11-13 11:14:53 -0800 |
commit | 2e8e70e56265496274e0c19464fffe896009bfc0 (patch) | |
tree | 8c2304aa5e65d7f668c2efab38305fea8f824a14 /tools | |
parent | 52ff94ce5134464db22720973e7773af0969b96f (diff) | |
download | linux-rpi3-2e8e70e56265496274e0c19464fffe896009bfc0.tar.gz linux-rpi3-2e8e70e56265496274e0c19464fffe896009bfc0.tar.bz2 linux-rpi3-2e8e70e56265496274e0c19464fffe896009bfc0.zip |
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>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/trace-event-info.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/perf/util/trace-event-info.c b/tools/perf/util/trace-event-info.c index 8f3b7ef221f2..71a5b4863707 100644 --- a/tools/perf/util/trace-event-info.c +++ b/tools/perf/util/trace-event-info.c @@ -533,12 +533,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; } |