[MTD] Fix potential leak in rfd_ftl_add_mtd

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Mon Jul 23 07:59:01 EDT 2007


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=1050643431c74d29ac972141cb24df1d9aca65cd
Commit:     1050643431c74d29ac972141cb24df1d9aca65cd
Parent:     4cfff0db3a60a775c29abd9cbc300fc0f616904b
Author:     Florin Malita <fmalita at gmail.com>
AuthorDate: Thu Jul 19 16:45:18 2007 -0400
Committer:  David Woodhouse <dwmw2 at infradead.org>
CommitDate: Mon Jul 23 12:05:07 2007 +0100

    [MTD] Fix potential leak in rfd_ftl_add_mtd
    
    This fixes a leak in the !mtd->erasesize error path (Coverity 1765).
    
    Signed-off-by: Florin Malita <fmalita at gmail.com>
    Signed-off-by: David Woodhouse <dwmw2 at infradead.org>
---
 drivers/mtd/rfd_ftl.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/mtd/rfd_ftl.c b/drivers/mtd/rfd_ftl.c
index d4b1ba8..006c03a 100644
--- a/drivers/mtd/rfd_ftl.c
+++ b/drivers/mtd/rfd_ftl.c
@@ -779,6 +779,7 @@ static void rfd_ftl_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
 	else {
 		if (!mtd->erasesize) {
 			printk(KERN_WARNING PREFIX "please provide block_size");
+			kfree(part);
 			return;
 		}
 		else



More information about the linux-mtd-cvs mailing list