linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] More PNP leaks.
@ 2004-09-01 15:51 Dave Jones
  0 siblings, 0 replies; only message in thread
From: Dave Jones @ 2004-09-01 15:51 UTC (permalink / raw)
  To: linux-kernel

Spotted with the source checker from Coverity.com.

Signed-off-by: Dave Jones <davej@redhat.com>


diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/pnp/pnpbios/proc.c linux-2.6/drivers/pnp/pnpbios/proc.c
--- bk-linus/drivers/pnp/pnpbios/proc.c	2004-06-04 12:08:32.000000000 +0100
+++ linux-2.6/drivers/pnp/pnpbios/proc.c	2004-06-07 11:07:05.000000000 +0100
@@ -90,8 +90,10 @@ static int proc_read_escd(char *buf, cha
 	tmpbuf = pnpbios_kmalloc(escd.escd_size, GFP_KERNEL);
 	if (!tmpbuf) return -ENOMEM;
 
-	if (pnp_bios_read_escd(tmpbuf, escd.nv_storage_base))
+	if (pnp_bios_read_escd(tmpbuf, escd.nv_storage_base)) {
+		kfree(tmpbuf);
 		return -EIO;
+	}
 
 	escd_size = (unsigned char)(tmpbuf[0]) + (unsigned char)(tmpbuf[1])*256;
 
@@ -168,8 +170,10 @@ static int proc_read_node(char *buf, cha
 
 	node = pnpbios_kmalloc(node_info.max_node_size, GFP_KERNEL);
 	if (!node) return -ENOMEM;
-	if (pnp_bios_get_dev_node(&nodenum, boot, node))
+	if (pnp_bios_get_dev_node(&nodenum, boot, node)) {
+		kfree(node);
 		return -EIO;
+	}
 	len = node->size - sizeof(struct pnp_bios_node);
 	memcpy(buf, node->data, len);
 	kfree(node);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-09-01 16:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-01 15:51 [PATCH] More PNP leaks Dave Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).