public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Felipe W Damasio <felipewd@terra.com.br>
To: Felipe W Damasio <felipewd@terra.com.br>
Cc: James.Bottomley@SteelEye.com, linux-scsi@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Memory leak in scsi_debug found by checker
Date: Tue, 23 Sep 2003 15:55:21 -0300	[thread overview]
Message-ID: <3F709719.6030107@terra.com.br> (raw)
In-Reply-To: <3F7096EE.8080105@terra.com.br>

[-- 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;
 }

      reply	other threads:[~2003-09-23 19:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3F709719.6030107@terra.com.br \
    --to=felipewd@terra.com.br \
    --cc=James.Bottomley@SteelEye.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox