perf metricgroup: Missed free on error path
authorIan Rogers <irogers@google.com>
Fri, 24 Oct 2025 17:58:38 +0000 (10:58 -0700)
committerNamhyung Kim <namhyung@kernel.org>
Tue, 4 Nov 2025 04:57:21 +0000 (20:57 -0800)
If an out-of-memory occurs the expr also needs freeing.

Signed-off-by: Ian Rogers <irogers@google.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/util/metricgroup.c

index 595b831..c822cf5 100644 (file)
@@ -1455,6 +1455,7 @@ static int parse_groups(struct evlist *perf_evlist,
 
                if (!expr->metric_name) {
                        ret = -ENOMEM;
+                       free(expr);
                        free(metric_events);
                        goto out;
                }