Commit 1f2d5f71 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[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.
parent e03dd6bd
......@@ -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 @@ int __init rd_load_image(char *from)
noclose_input:
close(out_fd);
out:
kfree(buf);
sys_unlink("/dev/ram");
return res;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment