]> granicus.if.org Git - apache/commitdiff
Make it so this thing doesn't segfault when apr_shm_init returns
authorCliff Woolley <jwoolley@apache.org>
Sat, 18 May 2002 06:29:52 +0000 (06:29 +0000)
committerCliff Woolley <jwoolley@apache.org>
Sat, 18 May 2002 06:29:52 +0000 (06:29 +0000)
an error.

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

modules/experimental/util_ldap_cache.c

index 816c3bf5d42dd77111daf2defbe6bf82a3866f93..aee694a376dcac2cdc01d7718fb5c32d590365b4 100644 (file)
@@ -293,22 +293,27 @@ apr_status_t util_ldap_cache_init(apr_pool_t *pool, apr_size_t reqsize)
 {
     apr_anylock_t rmm_lock;
 
-    apr_status_t result = APR_SUCCESS;
-    apr_pool_cleanup_register(pool, NULL, util_ldap_cache_module_kill, apr_pool_cleanup_null);
-
 #if APR_HAS_SHARED_MEMORY
+    apr_status_t result;
+
     result = apr_shm_create(&util_ldap_shm, reqsize, "/tmp/ldap_cache", pool);
+    if (result != APR_SUCCESS) {
+        return result;
+    }
 
     /* This will create a rmm "handler" to get into the shared memory area */
     apr_rmm_init(&util_ldap_rmm, &rmm_lock, 
                        (void *)apr_shm_baseaddr_get(util_ldap_shm), reqsize, pool);
 #endif
+
+    apr_pool_cleanup_register(pool, NULL, util_ldap_cache_module_kill, apr_pool_cleanup_null);
+
     util_ldap_cache = util_ald_create_cache(50,
                                     util_ldap_url_node_hash,
                                     util_ldap_url_node_compare,
                                     util_ldap_url_node_copy,
                                     util_ldap_url_node_free);
-    return result;
+    return APR_SUCCESS;
 }