[prev in list] [next in list] [prev in thread] [next in thread] 

List:       apr-cvs
Subject:    svn commit: r179208 - /apr/apr/trunk/memory/unix/apr_pools.c
From:       jorton () apache ! org
Date:       2005-05-31 11:42:42
Message-ID: 20050531114242.24085.qmail () minotaur ! apache ! org
[Download RAW message or body]

Author: jorton
Date: Tue May 31 04:42:40 2005
New Revision: 179208

URL: http://svn.apache.org/viewcvs?rev=179208&view=rev
Log:
Abort if the caller violates a joined-pool guarantee and explicitly
destroys a joined pool: (catches the mod_include pool lifetime issues
described in PR 12655)

* memory/unix/apr_pools.c (pool_destroy_debug): Renamed from
apr_pool_destroy_debug; made static.  (apr_pool_destroy_debug): New
function, wrapper for pool_destroy_debug; abort if called on a joined
pool.
(pool_clear_debug): Use pool_destroy_debug rather than the wrapper
to destroy subpools.

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

Modified: apr/apr/trunk/memory/unix/apr_pools.c
URL: http://svn.apache.org/viewcvs/apr/apr/trunk/memory/unix/apr_pools.c?rev=179208&r1=179207&r2=179208&view=diff
 ==============================================================================
--- apr/apr/trunk/memory/unix/apr_pools.c (original)
+++ apr/apr/trunk/memory/unix/apr_pools.c Tue May 31 04:42:40 2005
@@ -500,6 +500,9 @@
 static void run_child_cleanups(cleanup_t **c);
 static void free_proc_chain(struct process_chain *procs);
 
+#if APR_POOL_DEBUG
+static void pool_destroy_debug(apr_pool_t *pool, const char *file_line);
+#endif
 
 #if !APR_POOL_DEBUG
 /*
@@ -1361,7 +1364,7 @@
      * this pool thus this loop is safe and easy.
      */
     while (pool->child)
-        apr_pool_destroy_debug(pool->child, file_line);
+        pool_destroy_debug(pool->child, file_line);
 
     /* Run cleanups */
     run_cleanups(&pool->cleanups);
@@ -1436,8 +1439,7 @@
 #endif /* APR_HAS_THREADS */
 }
 
-APR_DECLARE(void) apr_pool_destroy_debug(apr_pool_t *pool,
-                                         const char *file_line)
+static void pool_destroy_debug(apr_pool_t *pool, const char *file_line)
 {
     apr_pool_check_integrity(pool);
 
@@ -1472,6 +1474,22 @@
 
     /* Free the pool itself */
     free(pool);
+}
+
+APR_DECLARE(void) apr_pool_destroy_debug(apr_pool_t *pool,
+                                         const char *file_line)
+{
+    if (pool->joined) {
+        /* Joined pools must not be explicitly destroyed; the caller
+         * has broken the guarantee. */
+#if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL)
+        apr_pool_log_event(pool, "LIFE",
+                           __FILE__ ":apr_pool_destroy abort on joined", 0);
+#endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL) */
+
+        abort();
+    }
+    pool_destroy_debug(pool, file_line);
 }
 
 APR_DECLARE(apr_status_t) apr_pool_create_ex_debug(apr_pool_t **newpool,


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic