summaryrefslogtreecommitdiff
path: root/tools/perf/util/util.h
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2021-11-17 23:38:04 -0800
committerArnaldo Carvalho de Melo <acme@redhat.com>2021-11-18 10:18:03 -0300
commitd9fc706108c15f8bc2d4ccccf8e50f74830fabd9 (patch)
tree6429455dcf71a961111daffdf78c4f96da0c7aae /tools/perf/util/util.h
parent0ca1f534a776cc7d42f2c33da4732b74ec2790cd (diff)
perf report: Fix memory leaks around perf_tip()
perf_tip() may allocate memory or use a literal, this means memory wasn't freed if allocated. Change the API so that literals aren't used. At the same time add missing frees for system_path. These issues were spotted using leak sanitizer. Signed-off-by: Ian Rogers <irogers@google.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lore.kernel.org/lkml/20211118073804.2149974-1-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/util.h')
-rw-r--r--tools/perf/util/util.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index ad737052e597..9f0d36ba77f2 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -39,7 +39,7 @@ int fetch_kernel_version(unsigned int *puint,
#define KVER_FMT "%d.%d.%d"
#define KVER_PARAM(x) KVER_VERSION(x), KVER_PATCHLEVEL(x), KVER_SUBLEVEL(x)
-const char *perf_tip(const char *dirpath);
+int perf_tip(char **strp, const char *dirpath);
#ifndef HAVE_SCHED_GETCPU_SUPPORT
int sched_getcpu(void);