perf metricgroup: Fix use after free in metric__new()
authorJosé Expósito <jose.exposito89@gmail.com>
Wed, 8 Dec 2021 17:11:13 +0000 (18:11 +0100)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 14 Jan 2022 14:46:59 +0000 (11:46 -0300)
commite000ea0beffb5497425054b151369fe37a792ece
tree32c4b42083739870ed72db1daebe55b7e853a941
parent99fc11bb5b6f19d2c3671d6cf38571cb3dedb472
perf metricgroup: Fix use after free in metric__new()

We shouldn't free() something that will be used in the next line, fix
it.

Fixes: b85a4d61d3022608 ("perf metric: Allow modifiers on metrics")
Addresses-Coverity-ID: 1494000
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: John Garry <john.garry@huawei.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/20211208171113.22089-1-jose.exposito89@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/metricgroup.c