aboutsummaryrefslogtreecommitdiffstats
path: root/init
diff options
context:
space:
mode:
authorAndrew Morton <akpm@digeo.com>2003-05-25 01:14:37 -0700
committerLinus Torvalds <torvalds@home.transmeta.com>2003-05-25 01:14:37 -0700
commit1f2d5f71c9fef60178fee126dc43cbb3bbaa98d1 (patch)
tree0febbbe0b205b99abd3d0bd1abb4849aa38d8194 /init
parente03dd6bdba3b190a82235266e43ac74c1455bdf8 (diff)
downloadhistory-1f2d5f71c9fef60178fee126dc43cbb3bbaa98d1.tar.gz
[PATCH] fix init/do_mounts_rd.c memory leak
From: Hollis Blanchard <hollis@austin.ibm.com> Another potential memory leak the Stanford checker caught at 2.5.48: while closing and opening floppy disks, buf could be allocated and never freed.
Diffstat (limited to 'init')
-rw-r--r--init/do_mounts_rd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/init/do_mounts_rd.c b/init/do_mounts_rd.c
index 33dbb38ae80bbf..9eb8eae5f60a18 100644
--- a/init/do_mounts_rd.c
+++ b/init/do_mounts_rd.c
@@ -129,7 +129,7 @@ int __init rd_load_image(char *from)
int in_fd, out_fd;
unsigned long rd_blocks, devblocks;
int nblocks, i, disk;
- char *buf;
+ char *buf = NULL;
unsigned short rotate = 0;
#if !defined(CONFIG_ARCH_S390) && !defined(CONFIG_PPC_ISERIES)
char rotator[4] = { '|' , '/' , '-' , '\\' };
@@ -226,7 +226,6 @@ int __init rd_load_image(char *from)
#endif
}
printk("done.\n");
- kfree(buf);
successful_load:
res = 1;
@@ -235,6 +234,7 @@ done:
noclose_input:
close(out_fd);
out:
+ kfree(buf);
sys_unlink("/dev/ram");
return res;
}