]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Fix a segfault in the LDAP cache purge.
authorGraham Leggett <minfrin@apache.org>
Sun, 19 Sep 2004 23:00:25 +0000 (23:00 +0000)
committerGraham Leggett <minfrin@apache.org>
Sun, 19 Sep 2004 23:00:25 +0000 (23:00 +0000)
PR:
Obtained from:
Submitted by: Jess Holle <jessh ptc.com>
Reviewed by:

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

CHANGES
modules/ldap/util_ldap_cache_mgr.c

diff --git a/CHANGES b/CHANGES
index 301fa57ec80bc70bd99e74ed8c65ebd6435c1e63..f13a41bc7efd46b0793c17336b17d3e19da1fb0d 100644 (file)
--- 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 <jessh ptc.com>]
+
   *) 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]
index a4268988550192e65104575bcf5ef61d378e52bf..a2fd5b0820189346a147dfef4deec7bcaa2f8486 100644 (file)
@@ -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;
 }