diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 1a9098c697b4..d19058a7b84c 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -256,6 +256,10 @@ static void perf_record__open(struct perf_record *rec) "trying to fall back to cpu-clock-ticks\n"); attr->type = PERF_TYPE_SOFTWARE; attr->config = PERF_COUNT_SW_CPU_CLOCK; + if (pos->name) { + free(pos->name); + pos->name = NULL; + } goto try_again; }