Commit 3c7cf5a7 authored by Cliff Woolley's avatar Cliff Woolley
Browse files

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
parent 95233dae
Loading
Loading
Loading
Loading
+9 −4
Changes for modules/experimental/util_ldap_cache.c: 9 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -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;
}