All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] nfs: fix unlikely memory leak
@ 2010-03-06 12:02 Dan Carpenter
  2010-03-06 14:28 ` Trond Myklebust
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2010-03-06 12:02 UTC (permalink / raw)
  To: kernel-janitors

I'll admit that it's unlikely for the first allocation to fail and 
the second one to succeed.  I won't be offended if you ignore this
patch.

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index eda74c4..f9254fb 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -5107,6 +5107,7 @@ static int nfs41_proc_async_sequence(struct nfs_client *clp,
 	res = kzalloc(sizeof(*res), GFP_KERNEL);
 	if (!args || !res) {
 		kfree(args);
+		kfree(res);
 		nfs_put_client(clp);
 		return -ENOMEM;
 	}

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

* Re: [patch] nfs: fix unlikely memory leak
  2010-03-06 12:02 [patch] nfs: fix unlikely memory leak Dan Carpenter
@ 2010-03-06 14:28 ` Trond Myklebust
  0 siblings, 0 replies; 2+ messages in thread
From: Trond Myklebust @ 2010-03-06 14:28 UTC (permalink / raw)
  To: kernel-janitors

On Sat, 2010-03-06 at 15:02 +0300, Dan Carpenter wrote: 
> I'll admit that it's unlikely for the first allocation to fail and 
> the second one to succeed.  I won't be offended if you ignore this
> patch.
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> 
> diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
> index eda74c4..f9254fb 100644
> --- a/fs/nfs/nfs4proc.c
> +++ b/fs/nfs/nfs4proc.c
> @@ -5107,6 +5107,7 @@ static int nfs41_proc_async_sequence(struct nfs_client *clp,
>  	res = kzalloc(sizeof(*res), GFP_KERNEL);
>  	if (!args || !res) {
>  		kfree(args);
> +		kfree(res);
>  		nfs_put_client(clp);
>  		return -ENOMEM;
>  	}

It's a good point. I will apply...

Cheers
  Trond

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

end of thread, other threads:[~2010-03-06 14:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-06 12:02 [patch] nfs: fix unlikely memory leak Dan Carpenter
2010-03-06 14:28 ` Trond Myklebust

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.