You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by jo...@apache.org on 2005/07/28 12:46:03 UTC

svn commit: r225746 - /httpd/httpd/trunk/modules/ldap/util_ldap_cache_mgr.c

Author: jorton
Date: Thu Jul 28 03:45:59 2005
New Revision: 225746

URL: http://svn.apache.org/viewcvs?rev=225746&view=rev
Log:
* modules/ldap/util_ldap_cache_mgr.c (util_ald_cache_insert): Fix a
cache corruption case: ensure that there is room in the cache for a
copy of the payload before inserting the node.

PR: 34209

Modified:
    httpd/httpd/trunk/modules/ldap/util_ldap_cache_mgr.c

Modified: httpd/httpd/trunk/modules/ldap/util_ldap_cache_mgr.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/modules/ldap/util_ldap_cache_mgr.c?rev=225746&r1=225745&r2=225746&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/ldap/util_ldap_cache_mgr.c (original)
+++ httpd/httpd/trunk/modules/ldap/util_ldap_cache_mgr.c Thu Jul 28 03:45:59 2005
@@ -406,11 +406,18 @@
         return NULL;
     }
 
+    /* Take a copy of the payload before proceeeding. */
+    payload = (*cache->copy)(cache, payload);
+    if (!payload) {
+        util_ald_free(cache, node);
+        return NULL;
+    }
+
     /* populate the entry */
     cache->inserts++;
     hashval = (*cache->hash)(payload) % cache->size;
     node->add_time = apr_time_now();
-    node->payload = (*cache->copy)(cache, payload);
+    node->payload = payload;
     node->next = cache->nodes[hashval];
     cache->nodes[hashval] = node;