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:
David Malone 2001-03-27 20:49:51 +00:00
parent 726098d35e
commit d1cadeb02a

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;