]> granicus.if.org Git - apache/commitdiff
another race condition.
authorIan Holsman <ianh@apache.org>
Tue, 12 Feb 2002 23:13:53 +0000 (23:13 +0000)
committerIan Holsman <ianh@apache.org>
Tue, 12 Feb 2002 23:13:53 +0000 (23:13 +0000)
also.. changed the logic slightly.
it will remove the name retrieved, not what the object has.

sorry for the spam.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@93380 13f79535-47bb-0310-9956-ffa450edef68

modules/experimental/mod_mem_cache.c

index 62bf70370652460ab4b1c4ae8ae591f889707edb..6c60191112151c7e6653cb48b5496ea8e5a6a38a 100644 (file)
@@ -450,25 +450,19 @@ static int remove_url(const char *type, const char *key)
     obj = (cache_object_t *) apr_hash_get(sconf->cacheht, 
                                           key, 
                                           APR_HASH_KEY_STRING);
+    if (obj) {
+        apr_hash_set(sconf->cacheht, key, APR_HASH_KEY_STRING, NULL);
+        cleanup_cache_object(obj);
+    }
     if (sconf->lock) {
         apr_thread_mutex_unlock(sconf->lock);
+
     }
 
     if (!obj) {
         return DECLINED;
     }
-
-    /* Found it. Now take it out of the cache and free it. */
-    if (sconf->lock) {
-        apr_thread_mutex_lock(sconf->lock);
-    }
-    apr_hash_set(sconf->cacheht, obj->key, strlen(obj->key), NULL);
-    if (sconf->lock) {
-        apr_thread_mutex_unlock(sconf->lock);
-    }
-
-    cleanup_cache_object(obj);
-
+    
     return OK;
 }