public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* leak in mtd/devices/phram.c
@ 2007-05-20 20:09 Eric Sesterhenn / Snakebyte
  2007-05-20 20:49 ` Jörn Engel
  2007-05-22  7:46 ` MikeW
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Sesterhenn / Snakebyte @ 2007-05-20 20:09 UTC (permalink / raw)
  To: joern; +Cc: linux-mtd

hi,

coverity spotted this leak in mtd/devices/phram.c (bug id #1512),
when register_device() fails, we dont kfree() name and leak it,
attached patch should fix this.

Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>


--- linux-2.6/drivers/mtd/devices/phram.c.orig	2007-05-20 22:04:24.000000000 +0200
+++ linux-2.6/drivers/mtd/devices/phram.c	2007-05-20 22:06:12.000000000 +0200
@@ -276,7 +276,9 @@ static int phram_setup(const char *val, 
 		parse_err("illegal device length\n");
 	}
 
-	register_device(name, start, len);
+	ret = register_device(name, start, len);
+	if (ret)
+		kfree(name);
 
 	return 0;
 }

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-05-22  7:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-20 20:09 leak in mtd/devices/phram.c Eric Sesterhenn / Snakebyte
2007-05-20 20:49 ` Jörn Engel
2007-05-22  7:46 ` MikeW

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox