perf metric: Fix some memory leaks - part 2

The metric_event_delete() missed to free expr->metric_events and it
should free an expr when metric_refs allocation failed.

Fixes: 4ea2896715e67 ("perf metric: Collect referenced metrics in struct metric_expr")
Signed-off-by: Namhyung Kim <>
Acked-by: Jiri Olsa <>
Cc: Alexander Shishkin <>
Cc: Andi Kleen <>
Cc: Ian Rogers <>
Cc: John Garry <>
Cc: Kajol Jain <>
Cc: Mark Rutland <>
Cc: Peter Zijlstra <>
Cc: Stephane Eranian <>
Signed-off-by: Arnaldo Carvalho de Melo <>
1 file changed