perf/x86/intel: Plug memory leak in intel_pmu_init()
authorThomas Gleixner <tglx@linutronix.de>
Wed, 27 Dec 2017 18:45:31 +0000 (19:45 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 3 Mar 2018 09:24:31 +0000 (10:24 +0100)
commit6b800ce9ee8452abfbbfe66bf9cdd13f4655e9a3
treee39a65a01d380d1ed244bcd2df013b6d3726a472
parent2f4c6c0453057d95ee910e65a0fec248f0cce5b8
perf/x86/intel: Plug memory leak in intel_pmu_init()

[ Upstream commit 7ad1437d6ace0e450a6c1167720608ad660b191d ]

A recent commit introduced an extra merge_attr() call in the skylake
branch, which causes a memory leak.

Store the pointer to the extra allocated memory and free it at the end of
the function.

Fixes: a5df70c354c2 ("perf/x86: Only show format attributes when supported")
Reported-by: Tommi Rantala <tommi.t.rantala@nokia.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/events/intel/core.c