public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lib: fix a memory leak risk
@ 2010-06-04 10:25 Wan ZongShun
  2010-06-04 15:27 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Wan ZongShun @ 2010-06-04 10:25 UTC (permalink / raw)
  To: LKML, Greg Kroah-Hartman

The netlink_kernel_create failed will arouse memory leak,
this patch is to add the 'kfree(ue_sk)' here.

Signed-off-by: Wan ZongShun <mcuos.com@gmail.com>

---
 lib/kobject_uevent.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
index 59c1551..08e15f7 100644
--- a/lib/kobject_uevent.c
+++ b/lib/kobject_uevent.c
@@ -378,6 +378,7 @@ static int uevent_net_init(struct net *net)
 	if (!ue_sk->sk) {
 		printk(KERN_ERR
 		       "kobject_uevent: unable to create netlink socket!\n");
+		kfree(ue_sk);
 		return -ENODEV;
 	}
 	mutex_lock(&uevent_sock_mutex);
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] lib: fix a memory leak risk
  2010-06-04 10:25 [PATCH] lib: fix a memory leak risk Wan ZongShun
@ 2010-06-04 15:27 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2010-06-04 15:27 UTC (permalink / raw)
  To: Wan ZongShun; +Cc: LKML

On Fri, Jun 04, 2010 at 06:25:28PM +0800, Wan ZongShun wrote:
> The netlink_kernel_create failed will arouse memory leak,
> this patch is to add the 'kfree(ue_sk)' here.
> 
> Signed-off-by: Wan ZongShun <mcuos.com@gmail.com>
> 
> ---
>  lib/kobject_uevent.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
> index 59c1551..08e15f7 100644
> --- a/lib/kobject_uevent.c
> +++ b/lib/kobject_uevent.c
> @@ -378,6 +378,7 @@ static int uevent_net_init(struct net *net)
>  	if (!ue_sk->sk) {
>  		printk(KERN_ERR
>  		       "kobject_uevent: unable to create netlink socket!\n");
> +		kfree(ue_sk);

Sorry, others already sent this patch in before you, it's already in the
linux-next tree, and is going to Linus later today.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-06-04 15:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-04 10:25 [PATCH] lib: fix a memory leak risk Wan ZongShun
2010-06-04 15:27 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox