From: tip-bot for Tejun Heo on
Commit-ID: 048c852051d2bd5da54a4488bc1f16b0fc74c695
Author: Tejun Heo <tj(a)>
AuthorDate: Sat, 1 May 2010 10:11:35 +0200
Committer: Ingo Molnar <mingo(a)>
CommitDate: Sat, 1 May 2010 13:11:25 +0200

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(a)>
Cc: Peter Zijlstra <peterz(a)>
Cc: Paul Mackerras <paulus(a)>
Cc: Arnaldo Carvalho de Melo <acme(a)>
Cc: <stable(a)>
LKML-Reference: <4BDBE237.1040809(a)>
Signed-off-by: Ingo Molnar <mingo(a)>
kernel/perf_event.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 2f3fbf8..3d1552d 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -4897,7 +4897,7 @@ err_fput_free_put_context:

if (err < 0)
- kfree(event);
+ free_event(event);

if (err < 0)
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)
More majordomo info at
Please read the FAQ at