]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
pullup:
authorBrian Wellington <source@isc.org>
Fri, 18 Aug 2000 21:53:46 +0000 (21:53 +0000)
committerBrian Wellington <source@isc.org>
Fri, 18 Aug 2000 21:53:46 +0000 (21:53 +0000)
dns_cache_setcleaninginterval() could try to access
timer after it had been freed

lib/dns/cache.c

index 5d01070af3f73abf316263d33cffb6e6251828b5..a03e8783b96f24febc4841f7f55ada2a3f045d25 100644 (file)
@@ -15,7 +15,7 @@
  * SOFTWARE.
  */
 
-/* $Id: cache.c,v 1.23 2000/06/07 02:38:30 marka Exp $ */
+/* $Id: cache.c,v 1.23.2.1 2000/08/18 21:53:46 bwelling Exp $ */
 
 #include <config.h>
 
@@ -298,6 +298,14 @@ dns_cache_dump(dns_cache_t *cache) {
 void
 dns_cache_setcleaninginterval(dns_cache_t *cache, unsigned int t) {
        LOCK(&cache->lock);
+
+       /*
+        * It may be the case that the cache has already shut down.
+        * If so, it has no timer.
+        */
+       if (cache->timer == NULL)
+               goto unlock;
+           
        cache->cleaner.cleaning_interval = t;
        if (t == 0) {
                isc_timer_reset(cache->cleaner.cleaning_timer,
@@ -310,7 +318,8 @@ dns_cache_setcleaninginterval(dns_cache_t *cache, unsigned int t) {
                                isc_timertype_ticker,
                                NULL, &interval, ISC_FALSE);
        }
-       UNLOCK(&cache->lock);   
+ unlock:
+       UNLOCK(&cache->lock);
 }
 
 /*