mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Alexander Shiyan <shc_work@mail.ru>
To: barebox@lists.infradead.org
Subject: [PATCH 7/9] NAND: imx: Fix memory leak
Date: Fri, 26 Apr 2013 20:41:12 +0400	[thread overview]
Message-ID: <1366994474-21325-7-git-send-email-shc_work@mail.ru> (raw)
In-Reply-To: <1366994474-21325-1-git-send-email-shc_work@mail.ru>


Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 drivers/mtd/nand/nand_imx_bbm.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/nand/nand_imx_bbm.c b/drivers/mtd/nand/nand_imx_bbm.c
index 03961a0..135d74e 100644
--- a/drivers/mtd/nand/nand_imx_bbm.c
+++ b/drivers/mtd/nand/nand_imx_bbm.c
@@ -91,7 +91,7 @@ static void *create_bbt(struct mtd_info *mtd)
 	buf = malloc(mtd->writesize);
 	if (!buf) {
 		ret = -ENOMEM;
-		goto out;
+		goto out2;
 	}
 
 	numblocks = mtd->size >> (chip->bbt_erase_shift - 1);
@@ -99,7 +99,7 @@ static void *create_bbt(struct mtd_info *mtd)
 	for (i = 0; i < numblocks;) {
 		ret = checkbad(mtd, from, buf);
 		if (ret < 0)
-			goto out;
+			goto out1;
 
 		if (ret) {
 			bbt[i >> 3] |= 0x03 << (i & 0x6);
@@ -112,8 +112,11 @@ static void *create_bbt(struct mtd_info *mtd)
 	}
 
 	return bbt;
-out:
+
+out1:
 	free(buf);
+out2:
+	free(bbt);
 
 	return ERR_PTR(ret);
 }
-- 
1.8.1.5


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2013-04-26 16:41 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-26 16:41 [PATCH 1/9] console: Fix possible null pointer dereference Alexander Shiyan
2013-04-26 16:41 ` [PATCH 2/9] ARM: at91 gpio: " Alexander Shiyan
2013-04-26 16:59   ` Jean-Christophe PLAGNIOL-VILLARD
2013-04-26 20:48     ` Sascha Hauer
2013-04-26 16:41 ` [PATCH 3/9] ARM: at91 smc: Fix possible uninitialized variable Alexander Shiyan
2013-04-26 16:59   ` Jean-Christophe PLAGNIOL-VILLARD
2013-04-26 17:09     ` Re[2]: " Alexander Shiyan
2013-04-26 20:49       ` Sascha Hauer
2013-04-26 16:41 ` [PATCH 4/9] MCI: atmel: Fix possible null pointer dereference Alexander Shiyan
2013-04-26 16:41 ` [PATCH 5/9] MCI: imx-esdhc: " Alexander Shiyan
2013-04-26 20:54   ` Sascha Hauer
2013-04-27  4:45     ` Re[2]: " Alexander Shiyan
2013-04-26 16:41 ` [PATCH 6/9] MCI: imx: " Alexander Shiyan
2013-04-26 16:41 ` Alexander Shiyan [this message]
2013-04-26 16:41 ` [PATCH 8/9] Serial: mpc5xxx: Fix setup mode at port initialization Alexander Shiyan
2013-04-30  7:39   ` Sascha Hauer
2013-04-30  7:46     ` Re[2]: " Alexander Shiyan
2013-04-26 16:41 ` [PATCH 9/9] MCI: imx-esdhc: Remove now unneeded check Alexander Shiyan
2013-04-26 20:57   ` Sascha Hauer

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=1366994474-21325-7-git-send-email-shc_work@mail.ru \
    --to=shc_work@mail.ru \
    --cc=barebox@lists.infradead.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