From: Yuan Can <yuancan@huawei.com>
To: <miquel.raynal@bootlin.com>, <richard@nod.at>, <vigneshr@ti.com>,
<rafal@milecki.pl>, <error27@gmail.com>,
<linux-mtd@lists.infradead.org>
Cc: <yuancan@huawei.com>
Subject: [PATCH] mtd: parsers: Fix potential memory leak in mtd_parser_tplink_safeloader_parse()
Date: Thu, 8 Dec 2022 08:38:59 +0000 [thread overview]
Message-ID: <20221208083859.122622-1-yuancan@huawei.com> (raw)
The parts needs to be freed with all its elements, otherwise it will be
leaked.
Fixes: 00a3588084be ("mtd: parsers: add TP-Link SafeLoader partitions table parser")
Signed-off-by: Yuan Can <yuancan@huawei.com>
---
drivers/mtd/parsers/tplink_safeloader.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/mtd/parsers/tplink_safeloader.c b/drivers/mtd/parsers/tplink_safeloader.c
index f601e7bd8627..860339461905 100644
--- a/drivers/mtd/parsers/tplink_safeloader.c
+++ b/drivers/mtd/parsers/tplink_safeloader.c
@@ -118,6 +118,7 @@ static int mtd_parser_tplink_safeloader_parse(struct mtd_info *mtd,
err_free:
for (idx -= 1; idx >= 0; idx--)
kfree(parts[idx].name);
+ kfree(parts);
err_out:
return err;
};
--
2.17.1
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next reply other threads:[~2022-12-08 8:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-08 8:38 Yuan Can [this message]
2022-12-08 9:35 ` [PATCH] mtd: parsers: Fix potential memory leak in mtd_parser_tplink_safeloader_parse() Dan Carpenter
2022-12-08 11:26 ` Yuan Can
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=20221208083859.122622-1-yuancan@huawei.com \
--to=yuancan@huawei.com \
--cc=error27@gmail.com \
--cc=linux-mtd@lists.infradead.org \
--cc=miquel.raynal@bootlin.com \
--cc=rafal@milecki.pl \
--cc=richard@nod.at \
--cc=vigneshr@ti.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