From: Cliff Woolley Date: Sat, 18 May 2002 06:29:52 +0000 (+0000) Subject: Make it so this thing doesn't segfault when apr_shm_init returns X-Git-Tag: 2.0.37~341 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a6fc26277284dd93b40fb497057ff63b75169c74;p=apache Make it so this thing doesn't segfault when apr_shm_init returns an error. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95169 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/experimental/util_ldap_cache.c b/modules/experimental/util_ldap_cache.c index 816c3bf5d4..aee694a376 100644 --- a/modules/experimental/util_ldap_cache.c +++ b/modules/experimental/util_ldap_cache.c @@ -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; }