diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index e9464b04f1492a06e8163bd9f2fb43491671a012..e37a6a3e62171e005b58b395bc1d7995bf88a44b 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -1480,7 +1480,8 @@ int parse_events_add_pmu(struct parse_events_state *parse_state, list_for_each_entry_safe(pos, tmp, &config_terms, list) { list_del_init(&pos->list); - zfree(&pos->val.str); + if (pos->free_str) + zfree(&pos->val.str); free(pos); } return -EINVAL;