Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Add some necessary but missing resource deallocation.
details: https://anonhg.NetBSD.org/src/rev/2f7f0bf0f96f
branches: trunk
changeset: 534439:2f7f0bf0f96f
user: enami <enami%NetBSD.org@localhost>
date: Fri Jul 26 06:04:12 2002 +0000
description:
Add some necessary but missing resource deallocation.
diffstat:
sys/kern/kern_proc.c | 17 +++++++++++------
1 files changed, 11 insertions(+), 6 deletions(-)
diffs (58 lines):
diff -r b6b5e5bc487f -r 2f7f0bf0f96f sys/kern/kern_proc.c
--- a/sys/kern/kern_proc.c Fri Jul 26 03:23:04 2002 +0000
+++ b/sys/kern/kern_proc.c Fri Jul 26 06:04:12 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_proc.c,v 1.48 2002/07/02 20:27:46 yamt Exp $ */
+/* $NetBSD: kern_proc.c,v 1.49 2002/07/26 06:04:12 enami Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.48 2002/07/02 20:27:46 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.49 2002/07/26 06:04:12 enami Exp $");
#include "opt_kstack.h"
@@ -371,8 +371,10 @@
panic("enterpgrp: new pgrp and pid != pgid");
#endif
pgrp = pool_get(&pgrp_pool, PR_WAITOK);
- if ((np = pfind(savepid)) == NULL || np != p)
+ if ((np = pfind(savepid)) == NULL || np != p) {
+ pool_put(&pgrp_pool, pgrp);
return (ESRCH);
+ }
if (mksess) {
struct session *sess;
@@ -381,6 +383,11 @@
*/
MALLOC(sess, struct session *, sizeof(struct session),
M_SESSION, M_WAITOK);
+ if ((np = pfind(savepid)) == NULL || np != p) {
+ FREE(sess, M_SESSION);
+ pool_put(&pgrp_pool, pgrp);
+ return (ESRCH);
+ }
sess->s_sid = p->p_pid;
sess->s_leader = p;
sess->s_count = 1;
@@ -539,14 +546,12 @@
newlim = limcopy(p->p_limit);
limfree(p->p_limit);
p->p_limit = newlim;
- } else {
- free(p->p_limit->pl_corename, M_TEMP);
}
+ free(p->p_limit->pl_corename, M_TEMP);
p->p_limit->pl_corename = defcorename;
}
}
-
#ifdef DEBUG
void
pgrpdump()
Home |
Main Index |
Thread Index |
Old Index