]> git.baikalelectronics.ru Git - kernel.git/commit
perf/x86/intel/uncore: Fix memory leaks on allocation failures
authorColin Ian King <colin.king@canonical.com>
Mon, 9 Oct 2017 17:26:55 +0000 (18:26 +0100)
committerIngo Molnar <mingo@kernel.org>
Tue, 10 Oct 2017 10:51:07 +0000 (12:51 +0200)
commitb44f18cd764bff96afc070c0b1cb7980efb75335
tree9011108701e6481c1248d097fcb666f1a6784493
parent2485d9ff63e4e1883c39220e4a02c06a8620bc53
perf/x86/intel/uncore: Fix memory leaks on allocation failures

Currently if an allocation fails then the error return paths
don't free up any currently allocated pmus[].boxes and pmus causing
a memory leak.  Add an error clean up exit path that frees these
objects.

Detected by CoverityScan, CID#711632 ("Resource Leak")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Peter Zijlstra <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: kernel-janitors@vger.kernel.org
Fixes: 8c45e18fdd9e ("perf/x86: Add generic Intel uncore PMU support")
Link: http://lkml.kernel.org/r/20171009172655.6132-1-colin.king@canonical.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/events/intel/uncore.c