From 13b76467458108df2074ad7fc8e862d22b7953c9 Mon Sep 17 00:00:00 2001 From: Ian Holsman Date: Tue, 12 Feb 2002 23:13:53 +0000 Subject: [PATCH] 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 --- modules/experimental/mod_mem_cache.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) 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; } -- 2.40.0