public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] do_mounts memory leak
@ 2003-02-05 21:39 Randy.Dunlap
  0 siblings, 0 replies; only message in thread
From: Randy.Dunlap @ 2003-02-05 21:39 UTC (permalink / raw)
  To: linux-kernel, torvalds

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

Hi,

The Stanford Checker identified a memory leak in
init/do_mounts.c.  This patch to 2.5.59 corrects it.
Please apply.

Thanks,
~Randy

[-- Attachment #2: mounts-memleak.patch --]
[-- Type: text/plain, Size: 724 bytes --]

diff -Naur ./init/do_mounts.c%LEAK ./init/do_mounts.c
--- ./init/do_mounts.c%LEAK	Thu Jan 16 18:22:02 2003
+++ ./init/do_mounts.c	Tue Feb  4 21:46:58 2003
@@ -653,12 +653,6 @@
 	/*
 	 * OK, time to copy in the data
 	 */
-	buf = kmalloc(BLOCK_SIZE, GFP_KERNEL);
-	if (buf == 0) {
-		printk(KERN_ERR "RAMDISK: could not allocate buffer\n");
-		goto done;
-	}
-
 	if (sys_ioctl(in_fd, BLKGETSIZE, (unsigned long)&devblocks) < 0)
 		devblocks = 0;
 	else
@@ -669,6 +663,12 @@
 
 	if (devblocks == 0) {
 		printk(KERN_ERR "RAMDISK: could not determine device size\n");
+		goto done;
+	}
+
+	buf = kmalloc(BLOCK_SIZE, GFP_KERNEL);
+	if (buf == 0) {
+		printk(KERN_ERR "RAMDISK: could not allocate buffer\n");
 		goto done;
 	}
 

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

only message in thread, other threads:[~2003-02-05 21:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-02-05 21:39 [PATCH] do_mounts memory leak Randy.Dunlap

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox