You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by mt...@apache.org on 2009/04/02 18:58:40 UTC

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

Author: mturk
Date: Thu Apr  2 16:58:40 2009
New Revision: 761344

URL: http://svn.apache.org/viewvc?rev=761344&view=rev
Log:
Both cleanup and pre_cleanup can share the same free list.
Axe the free_pre_cleanups and use free_cleanups for both

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=761344&r1=761343&r2=761344&view=diff
==============================================================================
--- apr/apr/trunk/memory/unix/apr_pools.c (original)
+++ apr/apr/trunk/memory/unix/apr_pools.c Thu Apr  2 16:58:40 2009
@@ -512,7 +512,6 @@
     apr_os_proc_t         owner_proc;
 #endif /* defined(NETWARE) */
     cleanup_t            *pre_cleanups;
-    cleanup_t            *free_pre_cleanups;
     cleanup_t            *final_cleanups;
 };
 
@@ -725,8 +724,6 @@
     /* Run pre destroy cleanups */
     run_cleanups(&pool->pre_cleanups);
     pool->pre_cleanups = NULL;
-    free_cleanups(&pool->free_pre_cleanups);
-    pool->free_pre_cleanups = NULL;
 
     /* Destroy the subpools.  The subpools will detach themselves from
      * this pool thus this loop is safe and easy.
@@ -755,8 +752,6 @@
     /* Run pre destroy cleanups */
     run_cleanups(&pool->pre_cleanups);
     pool->pre_cleanups = NULL;
-    free_cleanups(&pool->free_pre_cleanups);
-    pool->free_pre_cleanups = NULL;
 
     /* Destroy the subpools.  The subpools will detach themselve from
      * this pool thus this loop is safe and easy.
@@ -791,7 +786,6 @@
 
     block_list_destroy_all(pool->blocks);
     run_cleanups(&pool->final_cleanups);
-    free_cleanups(&pool->final_cleanups);
     block_list_destroy(&pool->final_block);
     free(pool);
 }
@@ -820,7 +814,6 @@
     pool->child = NULL;
     pool->free_cleanups = NULL;
     pool->pre_cleanups = NULL;
-    pool->free_pre_cleanups = NULL;
     pool->subprocesses = NULL;
     pool->user_data = NULL;
     pool->tag = NULL;
@@ -1875,10 +1868,10 @@
 #endif /* APR_POOL_DEBUG */
 
     if (p != NULL) {
-        if (p->free_pre_cleanups) {
+        if (p->free_cleanups) {
             /* reuse a cleanup structure */
-            c = p->free_pre_cleanups;
-            p->free_pre_cleanups = c->next;
+            c = p->free_cleanups;
+            p->free_cleanups = c->next;
         } else {
             c = malloc(sizeof(cleanup_t));
         }
@@ -1941,8 +1934,8 @@
         if (c->data == data && c->plain_cleanup_fn == cleanup_fn) {
             *lastp = c->next;
             /* move to freelist */
-            c->next = p->free_pre_cleanups;
-            p->free_pre_cleanups = c;
+            c->next = p->free_cleanups;
+            p->free_cleanups = c;
             break;
         }
 



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

Posted by Ruediger Pluem <rp...@apache.org>.

On 04/02/2009 06:58 PM, mturk@apache.org wrote:
> Author: mturk
> Date: Thu Apr  2 16:58:40 2009
> New Revision: 761344
> 
> URL: http://svn.apache.org/viewvc?rev=761344&view=rev
> Log:
> Both cleanup and pre_cleanup can share the same free list.
> Axe the free_pre_cleanups and use free_cleanups for both
> 
> 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=761344&r1=761343&r2=761344&view=diff
> ==============================================================================
> --- apr/apr/trunk/memory/unix/apr_pools.c (original)
> +++ apr/apr/trunk/memory/unix/apr_pools.c Thu Apr  2 16:58:40 2009

> @@ -791,7 +786,6 @@
>  
>      block_list_destroy_all(pool->blocks);
>      run_cleanups(&pool->final_cleanups);
> -    free_cleanups(&pool->final_cleanups);
>      block_list_destroy(&pool->final_block);
>      free(pool);
>  }

Guess this one was removed by mistake as it would lead to a memory leak.

Regards

RĂ¼diger