From 174ab4501ed2d92913b783e85ebd5cc688991f22 Mon Sep 17 00:00:00 2001 From: Bosko Milekic Date: Fri, 1 Aug 2003 17:42:27 +0000 Subject: [PATCH] Only free the pcpu cache buckets if they are non-NULL. Crashed this person's machine: harti Pointy-hat to: me --- sys/vm/uma_core.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c index a6bb05e12443..47daeeed342b 100644 --- a/sys/vm/uma_core.c +++ b/sys/vm/uma_core.c @@ -513,10 +513,12 @@ cache_drain(uma_zone_t zone, int destroy) bucket_drain(zone, cache->uc_allocbucket); bucket_drain(zone, cache->uc_freebucket); if (destroy) { - uma_zfree_internal(bucketzone, cache->uc_allocbucket, - NULL, 0); - uma_zfree_internal(bucketzone, cache->uc_freebucket, - NULL, 0); + if (cache->uc_allocbucket != NULL) + uma_zfree_internal(bucketzone, + cache->uc_allocbucket, NULL, 0); + if (cache->uc_freebucket != NULL) + uma_zfree_internal(bucketzone, + cache->uc_freebucket, NULL, 0); cache->uc_allocbucket = cache->uc_freebucket = NULL; } }