Don't leak the memory we've just malloced if we can't find the

process we're looking for. (I don't think this can currently
happen, but it depends how the function is called).

PR:		25932
Submitted by:	David Xu <davidx@viasoft.com.cn>
This commit is contained in:
dwmalone 2001-03-27 20:49:51 +00:00
parent 17ede005a9
commit 8d8bd0014f

View File

@ -187,10 +187,10 @@ enterpgrp(p, pgid, mksess)
*/
KASSERT(p->p_pid == pgid,
("enterpgrp: new pgrp and pid != pgid"));
MALLOC(pgrp, struct pgrp *, sizeof(struct pgrp), M_PGRP,
M_WAITOK);
if ((np = pfind(savepid)) == NULL || np != p)
return (ESRCH);
MALLOC(pgrp, struct pgrp *, sizeof(struct pgrp), M_PGRP,
M_WAITOK);
if (mksess) {
register struct session *sess;