diff --git a/CHANGES b/CHANGES index 301fa57ec8..f13a41bc7e 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,8 @@ Changes with Apache 2.1.0-dev [Remove entries to the current 2.0 section below, when backported] + *) Fix a segfault in the LDAP cache purge. [Jess Holle ] + *) mod_rewrite: Handle per-location rules when r->filename is unset. Previously this would segfault or simply not match as expected, depending on the platform. [Jeff Trawick] diff --git a/modules/ldap/util_ldap_cache_mgr.c b/modules/ldap/util_ldap_cache_mgr.c index a426898855..a2fd5b0820 100644 --- a/modules/ldap/util_ldap_cache_mgr.c +++ b/modules/ldap/util_ldap_cache_mgr.c @@ -173,7 +173,7 @@ unsigned long util_ald_hash_string(int nstr, ...) void util_ald_cache_purge(util_ald_cache_t *cache) { unsigned long i; - util_cache_node_t *p, *q; + util_cache_node_t *p, *q, **pp; apr_time_t t; if (!cache) @@ -184,7 +184,8 @@ void util_ald_cache_purge(util_ald_cache_t *cache) cache->numpurges++; for (i=0; i < cache->size; ++i) { - p = cache->nodes[i]; + pp = cache->nodes + i; + p = *pp; while (p != NULL) { if (p->add_time < cache->marktime) { q = p->next; @@ -192,10 +193,11 @@ void util_ald_cache_purge(util_ald_cache_t *cache) util_ald_free(cache, p); cache->numentries--; cache->npurged++; - p = q; + p = *pp = q; } else { - p = p->next; + pp = &(p->next); + p = *pp; } } } @@ -252,6 +254,8 @@ util_url_node_t *util_ald_create_caches(util_ldap_state_t *st, const char *url) newcurl = util_ald_cache_insert(st->util_ldap_cache, &curl); } + else + newcurl = NULL; return newcurl; }