From: Dan Carpenter <dan.carpenter@oracle.com>
To: Maxim Levitsky <maximlevitsky@gmail.com>
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Jens Axboe <axboe@kernel.dk>
Subject: [patch 2/2] memstick: memory leak on error in msb_ftl_scan()
Date: Sat, 29 Sep 2012 10:11:38 +0300 [thread overview]
Message-ID: <20120929071138.GC10993@elgon.mountain> (raw)
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;
next reply other threads:[~2012-09-29 7:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-29 7:11 Dan Carpenter [this message]
2012-09-29 22:10 ` [patch 2/2] memstick: memory leak on error in msb_ftl_scan() Maxim Levitsky
2012-09-29 22:14 ` Maxim Levitsky
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=20120929071138.GC10993@elgon.mountain \
--to=dan.carpenter@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maximlevitsky@gmail.com \
/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