aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWeiguo Li <[email protected]>2022-03-11 21:06:57 +0800
committerArnaldo Carvalho de Melo <[email protected]>2022-03-12 10:47:52 -0300
commita7a72631f62445e3671b7cab5ad01f856c1aa90d (patch)
treefb64c72074bd0676a2f934d69c43a28a2e6e3fd5
parentec9d50ace39925f7fd0302bf0fad640e2c9826ea (diff)
perf parse-events: Fix NULL check against wrong variable
We did a null check after "tmp->symbol = strdup(...)", but we checked "list->symbol" other than "tmp->symbol". Reviewed-by: John Garry <[email protected]> Signed-off-by: Weiguo Li <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
-rw-r--r--tools/perf/util/parse-events.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 9739b05b999e..dfb50a5f83d0 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -2193,7 +2193,7 @@ int perf_pmu__test_parse_init(void)
for (i = 0; i < ARRAY_SIZE(symbols); i++, tmp++) {
tmp->type = symbols[i].type;
tmp->symbol = strdup(symbols[i].symbol);
- if (!list->symbol)
+ if (!tmp->symbol)
goto err_free;
}