diff options
-rw-r--r-- | kernel/events/core.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/kernel/events/core.c b/kernel/events/core.c index e1af58e23bee..992b16aac559 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -8221,7 +8221,12 @@ err_context: perf_unpin_context(ctx); put_ctx(ctx); err_alloc: - free_event(event); + /* + * If event_file is set, the fput() above will have called ->release() + * and that will take care of freeing the event. + */ + if (!event_file) + free_event(event); err_cpus: put_online_cpus(); err_task: |