From 6ff6872590dc7a4d87921eb6d47a0d3f82d599c4 Mon Sep 17 00:00:00 2001 From: Dave Jones Date: Thu, 2 Sep 2004 00:39:04 -0700 Subject: [PATCH] [PATCH] More PNP leaks. Spotted with the source checker from Coverity.com. Signed-off-by: Dave Jones Signed-off-by: Linus Torvalds --- drivers/pnp/pnpbios/proc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/pnp/pnpbios/proc.c b/drivers/pnp/pnpbios/proc.c index 88fcd16687661..2fa4d21c7eee7 100644 --- a/drivers/pnp/pnpbios/proc.c +++ b/drivers/pnp/pnpbios/proc.c @@ -90,8 +90,10 @@ static int proc_read_escd(char *buf, char **start, off_t pos, 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, char **start, off_t pos, 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); -- 2.53.0