small memory leak in exec.c if exec_mmap fails

Peeter Joot (peeter@joot.com)
Fri, 2 Jan 1998 00:41:20 -0500 (EST)


Hello,

I think I have noticed a small memory leak in exec.c:flush_old_exec().

If exec_mmap() fails on a process that has CLONE_SIGHAND created clones
then the kmalloc'ed signal_struct won't be freed.

I have attached a small patch that should fix this (untested as
it as it is not an easily reprodable scenerio)

Peeter

--
Peeter Joot
http://www.accessv.com/~peeter                               peeter@accessv.com

--- exec.c.orig Fri Jan 2 00:16:39 1998 +++ exec.c Fri Jan 2 00:16:07 1998 @@ -518,7 +518,7 @@ * Release all of the old mmap stuff */ retval = exec_mmap(); - if (retval) goto flush_failed; + if (retval) goto mmap_failed; /* This is the point of no return */ release_old_signals(oldsig); @@ -547,6 +547,9 @@ return 0; +mmap_failed: + if (current->sig != oldsig) + kfree(current->sig); flush_failed: current->sig = oldsig; return retval;