diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 1999-02-23 18:17:20 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 1999-02-23 18:17:20 +0000 |
commit | 1b5758b9c033a5a25ad596cf8f0eb7b10de98525 (patch) | |
tree | abf0e4dcacc19d653f7c66681f37dc30084e2652 /sys | |
parent | ba052b987cf806890bafd264b6a1c4287523edb2 (diff) |
Ooops! Move the allocation of the U area to after the limits checks.
That was a memory leak.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_fork.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 68a0e497a28..d9582abe989 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_fork.c,v 1.14 1999/02/19 19:21:42 art Exp $ */ +/* $OpenBSD: kern_fork.c,v 1.15 1999/02/23 18:17:19 art Exp $ */ /* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */ /* @@ -114,17 +114,6 @@ fork1(p1, forktype, rforkflags, retval) int dupfd = 1, cleanfd = 0; vm_offset_t uaddr; - /* - * Allocate a pcb and kernel stack for the process - */ -#if defined(arc) || defined(mips_cachealias) - uaddr = kmem_alloc_upage(kernel_map, USPACE); -#else - uaddr = kmem_alloc_pageable(kernel_map, USPACE); -#endif - if (uaddr == 0) - return ENOMEM; - if (forktype == ISRFORK) { dupfd = 0; if ((rforkflags & RFPROC) == 0) @@ -160,6 +149,17 @@ fork1(p1, forktype, rforkflags, retval) return (EAGAIN); } + /* + * Allocate a pcb and kernel stack for the process + */ +#if defined(arc) || defined(mips_cachealias) + uaddr = kmem_alloc_upage(kernel_map, USPACE); +#else + uaddr = kmem_alloc_pageable(kernel_map, USPACE); +#endif + if (uaddr == 0) + return ENOMEM; + /* Allocate new proc. */ MALLOC(newproc, struct proc *, sizeof(struct proc), M_PROC, M_WAITOK); |