From: Ian Holsman Date: Tue, 12 Feb 2002 23:13:53 +0000 (+0000) Subject: another race condition. X-Git-Tag: 2.0.33~289 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=13b76467458108df2074ad7fc8e862d22b7953c9;p=apache another race condition. 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 --- diff --git a/modules/experimental/mod_mem_cache.c b/modules/experimental/mod_mem_cache.c index 62bf703706..6c60191112 100644 --- a/modules/experimental/mod_mem_cache.c +++ b/modules/experimental/mod_mem_cache.c @@ -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; }