public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Maxim Levitsky <maximlevitsky@gmail.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Jens Axboe <axboe@kernel.dk>
Subject: Re: [patch 2/2] memstick: memory leak on error in msb_ftl_scan()
Date: Sun, 30 Sep 2012 00:14:44 +0200	[thread overview]
Message-ID: <1348956884.7401.3.camel@maxim-laptop> (raw)
In-Reply-To: <1348956616.7401.2.camel@maxim-laptop>

On Sun, 2012-09-30 at 00:10 +0200, Maxim Levitsky wrote: 
> On Sat, 2012-09-29 at 10:11 +0300, Dan Carpenter wrote: 
> > We need to free "overwrite_flags" before returning.
> > 
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > 
> > diff --git a/drivers/memstick/core/ms_block.c b/drivers/memstick/core/ms_block.c
> > index a8e8915..1f9d5cf 100644
> > --- a/drivers/memstick/core/ms_block.c
> > +++ b/drivers/memstick/core/ms_block.c
> > @@ -1408,8 +1408,10 @@ static int msb_ftl_scan(struct msb_data *msb)
> >  			msb_mark_block_used(msb, pba);
> >  			msb_erase_block(msb, pba);
> >  			continue;
> > -		} else if (error)
> > +		} else if (error) {
> > +			kfree(overwrite_flags);
> >  			return error;
> > +		}
> >  
> >  		lba = be16_to_cpu(extra.logical_address);
> >  		managment_flag = extra.management_flag;
> 
> Indeed. I need to be more careful with this,
> I'll do another review of the code, maybe I spot anything else.
> 
> Acked-by: Maxim Levitsky <maximlevitsly@gmail.com>
maximlevitsky@gmail.com> :-(





      reply	other threads:[~2012-09-29 22:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-29  7:11 [patch 2/2] memstick: memory leak on error in msb_ftl_scan() Dan Carpenter
2012-09-29 22:10 ` Maxim Levitsky
2012-09-29 22:14   ` Maxim Levitsky [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1348956884.7401.3.camel@maxim-laptop \
    --to=maximlevitsky@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox