]> git.baikalelectronics.ru Git - kernel.git/commit
perf tools: Free temporary 'sys' string in read_event_files()
authorSanskriti Sharma <sansharm@redhat.com>
Tue, 2 Oct 2018 14:29:14 +0000 (10:29 -0400)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 8 Oct 2018 17:23:46 +0000 (14:23 -0300)
commit9fc4be143cbe976b9e6fea5a82bff096e6492c03
treed6925aa5ef68766b81af06976303945bca90e409
parent057bc281b99bec6a81f97f171b2fd26935d888ea
perf tools: Free temporary 'sys' string in read_event_files()

For each system in a given pevent, read_event_files() reads in a
temporary 'sys' string.  Be sure to free this string before moving onto
to the next system and/or leaving read_event_files().

Fixes the following coverity complaints:

  Error: RESOURCE_LEAK (CWE-772):

  tools/perf/util/trace-event-read.c:343: overwrite_var: Overwriting
  "sys" in "sys = read_string()" leaks the storage that "sys" points to.

  tools/perf/util/trace-event-read.c:353: leaked_storage: Variable "sys"
  going out of scope leaks the storage it points to.

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-6-git-send-email-sansharm@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/trace-event-read.c