-- 
Thanks,
Oliver
commit 4ae1b4aac1727a7d3633b932666e2fc459a7ff42
Author: Jesper Juhl <[EMAIL PROTECTED]>
Date:   Tue Jul 31 00:39:39 2007 -0700

    From f2912a1223c0917a7b4e054f18086209137891ea Mon Sep 17 00:00:00 2001
    Subject: [PATCH] cciss: fix memory leak
    
    There's a memory leak in the cciss driver.
    
    in alloc_cciss_hba() we may leak sizeof(ctlr_info_t) bytes if a
    call to alloc_disk(1 << NWD_SHIFT) fails.
    This patch should fix the issue.
    
    Spotted by the Coverity checker.
    
    Signed-off-by: Jesper Juhl <[EMAIL PROTECTED]>
    Acked-by: Mike Miller <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>

diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 559497a..355fc17 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -3226,12 +3226,15 @@ static int alloc_cciss_hba(void)
 	for (i = 0; i < MAX_CTLR; i++) {
 		if (!hba[i]) {
 			ctlr_info_t *p;
+
 			p = kzalloc(sizeof(ctlr_info_t), GFP_KERNEL);
 			if (!p)
 				goto Enomem;
 			p->gendisk[0] = alloc_disk(1 << NWD_SHIFT);
-			if (!p->gendisk[0])
+			if (!p->gendisk[0]) {
+				kfree(p);
 				goto Enomem;
+			}
 			hba[i] = p;
 			return i;
 		}

Reply via email to