possible memory leak in 2.0.29 - patch

Ray Lehtiniemi (rayl@crosskeys.com)
Sat, 5 Apr 1997 23:20:32 -0500 (EST)


hi

here is a patch for what appears (to the untrained eye :) to be a memory
leak. the only way i could see the mm_struct being freed was via
do_exit-->__free_mm, but that seemed unlikely in these two cases.

i've compiled and booted this, but i'm a little unsure how to actually
test it. it's against 2.0.29.

--- linux/kernel/fork.c.old Sat Apr 5 22:14:37 1997
+++ linux/kernel/fork.c Sat Apr 5 22:16:52 1997
@@ -126,10 +126,13 @@
tsk->min_flt = tsk->maj_flt = 0;
tsk->cmin_flt = tsk->cmaj_flt = 0;
tsk->nswap = tsk->cnswap = 0;
- if (new_page_tables(tsk))
+ if (new_page_tables(tsk)) {
+ kfree(mm);
return -1;
+ }
if (dup_mmap(mm)) {
free_page_tables(mm);
+ kfree(mm);
return -1;
}
return 0;

---------------------------------------------------------------------------
Ray Lehtiniemi <rayl@crosskeys.com>