diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2002-07-23 15:26:49 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2002-07-23 15:26:49 +0000 |
commit | 2bdabd30e7ceebcbfcca83433b2dfcf488c9cc89 (patch) | |
tree | 7d559a603e81793d1e7e723191390365d491c0d2 /sys/kern/subr_pool.c | |
parent | 90bbad4fd199eb0514a744c970f756d558e82564 (diff) |
Please tell me what crack I've been smoking when I did that.
When trying the drain hook just in pool_allocator_alloc, don't leak memory
when the drain succeeds and don't avoid draining other pools if this
pool doesn't have a drain hook.
Diffstat (limited to 'sys/kern/subr_pool.c')
-rw-r--r-- | sys/kern/subr_pool.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sys/kern/subr_pool.c b/sys/kern/subr_pool.c index 3930cdcbab6..03f14303eb8 100644 --- a/sys/kern/subr_pool.c +++ b/sys/kern/subr_pool.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_pool.c,v 1.30 2002/06/09 00:15:33 niklas Exp $ */ +/* $OpenBSD: subr_pool.c,v 1.31 2002/07/23 15:26:48 art Exp $ */ /* $NetBSD: subr_pool.c,v 1.61 2001/09/26 07:14:56 chs Exp $ */ /*- @@ -1941,12 +1941,12 @@ pool_allocator_alloc(struct pool *org, int flags) * In other cases the hook will be run in * pool_reclaim. */ - if (org->pr_drain_hook == NULL) - break; - (*org->pr_drain_hook)(org->pr_drain_hook_arg, flags); - if ((res = (*pa->pa_alloc)(org, flags)) != NULL) - continue; - break; + if (org->pr_drain_hook != NULL) { + (*org->pr_drain_hook)(org->pr_drain_hook_arg, + flags); + if ((res = (*pa->pa_alloc)(org, flags)) != NULL) + return (res); + } } s = splvm(); simple_lock(&pa->pa_slock); |