You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by sf...@apache.org on 2013/05/03 21:22:26 UTC

svn commit: r1478934 - /apr/apr/trunk/memory/unix/apr_pools.c

Author: sf
Date: Fri May  3 19:22:11 2013
New Revision: 1478934

URL: http://svn.apache.org/r1478934
Log:
Fix invalid free when destroying pools created with
apr_pool_create_unmanaged_ex()

PR: 54892
Submitted by: Valeriy V. Argunov <hzdbyte gmail com>

Modified:
    apr/apr/trunk/memory/unix/apr_pools.c

Modified: apr/apr/trunk/memory/unix/apr_pools.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/memory/unix/apr_pools.c?rev=1478934&r1=1478933&r2=1478934&view=diff
==============================================================================
--- apr/apr/trunk/memory/unix/apr_pools.c (original)
+++ apr/apr/trunk/memory/unix/apr_pools.c Fri May  3 19:22:11 2013
@@ -1003,21 +1003,6 @@ APR_DECLARE(apr_status_t) apr_pool_creat
     if (!apr_pools_initialized)
         return APR_ENOPOOL;
     if ((pool_allocator = allocator) == NULL) {
-#if !APR_ALLOCATOR_USES_MMAP
-        if ((pool_allocator = malloc(MIN_ALLOC)) == NULL) {
-            if (abort_fn)
-                abort_fn(APR_ENOMEM);
-
-            return APR_ENOMEM;
-        }
-        memset(pool_allocator, 0, SIZEOF_ALLOCATOR_T);
-        pool_allocator->max_free_index = APR_ALLOCATOR_MAX_FREE_UNLIMITED;
-        node = (apr_memnode_t *)((char *)pool_allocator + SIZEOF_ALLOCATOR_T);
-        node->next  = NULL;
-        node->index = 1;
-        node->first_avail = (char *)node + APR_MEMNODE_T_SIZE;
-        node->endp = (char *)pool_allocator + MIN_ALLOC;
-#else
         if (apr_allocator_create(&pool_allocator) != APR_SUCCESS) {
             if (abort_fn)
                 abort_fn(APR_ENOMEM);
@@ -1031,7 +1016,6 @@ APR_DECLARE(apr_status_t) apr_pool_creat
 
             return APR_ENOMEM;
         }
-#endif
     }
     else if ((node = allocator_alloc(pool_allocator,
                                      MIN_ALLOC - APR_MEMNODE_T_SIZE)) == NULL) {