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:
parent
17928d1153
commit
69aa768aef
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=177455
@ -256,6 +256,7 @@ fork1(td, flags, pages, procp)
|
||||
* 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 @@ fork1(td, flags, pages, procp)
|
||||
error = ENOMEM;
|
||||
goto fail1;
|
||||
}
|
||||
} else
|
||||
vm2 = NULL;
|
||||
}
|
||||
#ifdef MAC
|
||||
mac_proc_init(newproc);
|
||||
#endif
|
||||
@ -740,6 +740,8 @@ fork1(td, flags, pages, procp)
|
||||
mac_proc_destroy(newproc);
|
||||
#endif
|
||||
fail1:
|
||||
if (vm2 != NULL)
|
||||
vmspace_free(vm2);
|
||||
uma_zfree(proc_zone, newproc);
|
||||
pause("fork", hz / 2);
|
||||
return (error);
|
||||
|
Loading…
Reference in New Issue
Block a user