linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Memory leak in scsi_debug found by checker
@ 2003-09-23 18:54 Felipe W Damasio
  2003-09-23 18:55 ` Felipe W Damasio
  0 siblings, 1 reply; 2+ messages in thread
From: Felipe W Damasio @ 2003-09-23 18:54 UTC (permalink / raw)
  To: James.Bottomley; +Cc: linux-scsi, Linux Kernel Mailing List

	Hi James,

	Patch against 2.6-test5.

	If in the middle of loop a kmalloc failed, that means that the 
previous calls succeeded..so they must be also be freed (and removed 
from the dev_info_list).

	Please review and consider applying.

	Cheers,

Felipe


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

* Re: [PATCH] Memory leak in scsi_debug found by checker
  2003-09-23 18:54 [PATCH] Memory leak in scsi_debug found by checker Felipe W Damasio
@ 2003-09-23 18:55 ` Felipe W Damasio
  0 siblings, 0 replies; 2+ messages in thread
From: Felipe W Damasio @ 2003-09-23 18:55 UTC (permalink / raw)
  To: Felipe W Damasio; +Cc: James.Bottomley, linux-scsi, Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 346 bytes --]

	Forgot the patch :)

Felipe W Damasio wrote:
>     Hi James,
> 
>     Patch against 2.6-test5.
> 
>     If in the middle of loop a kmalloc failed, that means that the 
> previous calls succeeded..so they must be also be freed (and removed 
> from the dev_info_list).
> 
>     Please review and consider applying.
> 
>     Cheers,
> 
> Felipe
> 

[-- Attachment #2: scsi_debug-leak.patch --]
[-- Type: text/plain, Size: 981 bytes --]

--- linux-2.6.0-test5/drivers/scsi/scsi_debug.c.orig	2003-09-23 15:46:57.000000000 -0300
+++ linux-2.6.0-test5/drivers/scsi/scsi_debug.c	2003-09-23 15:43:39.000000000 -0300
@@ -1614,7 +1614,7 @@
                         printk(KERN_ERR "%s: out of memory at line %d\n",
                                __FUNCTION__, __LINE__);
                         error = -ENOMEM;
-			goto clean1;
+			goto clean;
                 }
                 memset(sdbg_devinfo, 0, sizeof(*sdbg_devinfo));
                 sdbg_devinfo->sdbg_host = sdbg_host;
@@ -1634,12 +1634,12 @@
         error = device_register(&sdbg_host->dev);
 
         if (error)
-		goto clean2;
+		goto clean;
 
 	++scsi_debug_add_host;
         return error;
 
-clean2:
+clean:
 	list_for_each_safe(lh, lh_sf, &sdbg_host->dev_info_list) {
 		sdbg_devinfo = list_entry(lh, struct sdebug_dev_info,
 					  dev_list);
@@ -1647,7 +1647,6 @@
 		kfree(sdbg_devinfo);
 	}
 
-clean1:
 	kfree(sdbg_host);
         return error;
 }

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

end of thread, other threads:[~2003-09-23 19:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-23 18:54 [PATCH] Memory leak in scsi_debug found by checker Felipe W Damasio
2003-09-23 18:55 ` Felipe W Damasio

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).