Re: [PATCH ftrace/core 3/3] trace: Fix memory leak when new instance creation failed
From: Steven Rostedt
Date: Fri Jun 06 2014 - 00:07:51 EST
On Fri, 06 Jun 2014 07:35:22 +0900
Yoshihiro YUNOMAE <yoshihiro.yunomae.ez@xxxxxxxxxxx> wrote:
> Current new_instance_create() implements just two fail paths for four
> allocation operations. So, it can induce memory leak if new instance
> creation failed. This patch fixes it by defining all fail paths and
> freeing allocated memories appropriately.
>
We don't need all the labels. The kfree() can handle NULL pointers.
Also, it's for a very unlikely case so we don't care about performance.
Here's the patch I'm adding:
-- Steve