]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
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 595b83142d2cc5fdcd18324112077569b21165b2..c822cf5da53b3f49b5cc6f49abdb9bab265b5ce9 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;
                }