From d1cadeb02af29f9805fa969d30723363f5aea4a6 Mon Sep 17 00:00:00 2001 From: David Malone Date: Tue, 27 Mar 2001 20:49:51 +0000 Subject: [PATCH] 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 --- sys/kern/kern_proc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c index 46c373981f44..36b01ef10369 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;