Fix the leak of the vmspace on the fork when the process limits

are exceeded.

Pointy hat to:	me
MFC after:	3 days
This commit is contained in:
Konstantin Belousov 2008-03-20 15:24:49 +00:00
parent 17928d1153
commit 69aa768aef

View File

@ -256,6 +256,7 @@ norfproc_fail:
* however it proved un-needed and caused problems
*/
vm2 = NULL;
/* Allocate new proc. */
newproc = uma_zalloc(proc_zone, M_WAITOK);
if (TAILQ_EMPTY(&newproc->p_threads)) {
@ -281,8 +282,7 @@ norfproc_fail:
error = ENOMEM;
goto fail1;
}
} else
vm2 = NULL;
}
#ifdef MAC
mac_proc_init(newproc);
#endif
@ -740,6 +740,8 @@ fail:
mac_proc_destroy(newproc);
#endif
fail1:
if (vm2 != NULL)
vmspace_free(vm2);
uma_zfree(proc_zone, newproc);
pause("fork", hz / 2);
return (error);