diff options
author | dwmalone <dwmalone@FreeBSD.org> | 2001-03-27 20:49:51 +0000 |
---|---|---|
committer | dwmalone <dwmalone@FreeBSD.org> | 2001-03-27 20:49:51 +0000 |
commit | 8d8bd0014f4756f412c4ccceaae8a76af5cff1c9 (patch) | |
tree | ad16f55c8c75b93d479ea2a3f76ccc4eb36cf746 | |
parent | 17ede005a9d271e69b1cd0bba9e0581657357e03 (diff) | |
download | FreeBSD-src-8d8bd0014f4756f412c4ccceaae8a76af5cff1c9.zip FreeBSD-src-8d8bd0014f4756f412c4ccceaae8a76af5cff1c9.tar.gz |
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>
-rw-r--r-- | sys/kern/kern_proc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index 46c3739..36b01ef 100644 --- a/sys/kern/kern_proc.c +++ b/sys/kern/kern_proc.c @@ -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; |