summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/metricgroup.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2019-07-13 11:12:47 +0200
committerIngo Molnar <mingo@kernel.org>2019-07-13 11:12:47 +0200
commite5eb08ac81d237e19fc68888bbba2cf88891bbe9 (patch)
treef4425e7d47f6724dc834583a1d4eab8b5d9f6344 /tools/perf/util/metricgroup.c
parentMerge tag 'driver-core-5.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/... (diff)
parentperf intel-pt: Fix potential NULL pointer dereference found by the smatch tool (diff)
downloadlinux-e5eb08ac81d237e19fc68888bbba2cf88891bbe9.tar.xz
linux-e5eb08ac81d237e19fc68888bbba2cf88891bbe9.zip
Merge tag 'perf-core-for-mingo-5.3-20190709' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent
Pull perf/core improvements and fixes: Intel PT: Adrian Hunter: - Fix DROP VIEW power_events_view in the postgresql and sqlite export-db python scripts. perf script: Song Liu: - Assume native_arch for pipe mode, fixing a segfault. perf inject: Arnaldo Carvalho de Melo: - The tool->read() call may pass a NULL evsel, handle it. core: Arnaldo Carvalho de Melo: - Move zalloc/zfree.c to tools/lib, further eroding tools/perf/util.[ch] - Use zfree() where applicable instead of open coded equivalent. - Add stdlib.h and some other headers to places where its needed and were getting via util.h, that doesn't need that anymore. - Use list_del_init() more thoroughly. Miscellaneous: Leo Yan: - Fix use after free and potential NULL pointer derefs detected by the smatch tool in various places. Luke Mujica: - Remove a couple unused variables in the parse-events code. Numfor Mbiziwo-Tiapo: - Initialize variable to suppress memory sanitizer warning in the mmap-thread-lookup 'perf test' entry. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/perf/util/metricgroup.c')
-rw-r--r--tools/perf/util/metricgroup.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/tools/perf/util/metricgroup.c b/tools/perf/util/metricgroup.c
index d8164574cb16..416a9015405e 100644
--- a/tools/perf/util/metricgroup.c
+++ b/tools/perf/util/metricgroup.c
@@ -18,6 +18,7 @@
#include "strlist.h"
#include <assert.h>
#include <linux/ctype.h>
+#include <linux/zalloc.h>
struct metric_event *metricgroup__lookup(struct rblist *metric_events,
struct perf_evsel *evsel,
@@ -235,7 +236,7 @@ static struct rb_node *mep_new(struct rblist *rl __maybe_unused,
goto out_name;
return &me->nd;
out_name:
- free((char *)me->name);
+ zfree(&me->name);
out_me:
free(me);
return NULL;
@@ -263,7 +264,7 @@ static void mep_delete(struct rblist *rl __maybe_unused,
struct mep *me = container_of(nd, struct mep, nd);
strlist__delete(me->metrics);
- free((void *)me->name);
+ zfree(&me->name);
free(me);
}
@@ -489,8 +490,9 @@ static void metricgroup__free_egroups(struct list_head *group_list)
list_for_each_entry_safe (eg, egtmp, group_list, nd) {
for (i = 0; i < eg->idnum; i++)
- free((char *)eg->ids[i]);
- free(eg->ids);
+ zfree(&eg->ids[i]);
+ zfree(&eg->ids);
+ list_del_init(&eg->nd);
free(eg);
}
}