perf: Fix resource leak in failure path of perf_event_open()

perf_event_open() kfrees event after init failure which doesn't
release all resources allocated by perf_event_alloc().  Use
free_event() instead.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Paul Mackerras <paulus@au1.ibm.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: <stable@kernel.org>
LKML-Reference: <4BDBE237.1040809@kernel.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
Tejun Heo 2010-05-01 10:11:35 +02:00 committed by Ingo Molnar
parent 66f41d4c5c
commit 048c852051
1 changed files with 1 additions and 1 deletions

View File

@ -4897,7 +4897,7 @@ err_fput_free_put_context:
err_free_put_context:
if (err < 0)
kfree(event);
free_event(event);
err_put_context:
if (err < 0)