apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jor...@apache.org
Subject svn commit: r493838 - in /apr/apr/trunk: CHANGES memory/unix/apr_pools.c
Date Sun, 07 Jan 2007 21:06:18 GMT
Author: jorton
Date: Sun Jan  7 13:06:18 2007
New Revision: 493838

URL: http://svn.apache.org/viewvc?view=rev&rev=493838
Log:
* memory/unix/apr_pools.c (apr_pool_initialize): Fix possible crash
with verbose debugging enabled.

PR: 41063
Submitted by: Peter Steiner <peter.steiner+apache hugwi.ch>

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

Modified: apr/apr/trunk/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr/trunk/CHANGES?view=diff&rev=493838&r1=493837&r2=493838
==============================================================================
--- apr/apr/trunk/CHANGES (original)
+++ apr/apr/trunk/CHANGES Sun Jan  7 13:06:18 2007
@@ -1,5 +1,9 @@
 Changes for APR 1.3.0
 
+  *) Fix possible crash in apr_pool_initialize() when built with 
+     verbose pool debugging.  PR 41063.  
+     [Peter Steiner <peter.steiner+apache hugwi.ch>]
+
   *) Fix --disable-ipv6 build on platforms with getifaddrs().
      PR 39199.  [Joe Orton]
 

Modified: apr/apr/trunk/memory/unix/apr_pools.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/memory/unix/apr_pools.c?view=diff&rev=493838&r1=493837&r2=493838
==============================================================================
--- apr/apr/trunk/memory/unix/apr_pools.c (original)
+++ apr/apr/trunk/memory/unix/apr_pools.c Sun Jan  7 13:06:18 2007
@@ -1233,6 +1233,7 @@
     apr_status_t rv;
 #if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL)
     char *logpath;
+    apr_file_t *debug_log = NULL;
 #endif
 
     if (apr_pools_initialized++)
@@ -1262,13 +1263,20 @@
 #if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL)
     rv = apr_env_get(&logpath, "APR_POOL_DEBUG_LOG", global_pool);
 
+    /* Don't pass file_stderr directly to apr_file_open() here, since
+     * apr_file_open() can call back to apr_pool_log_event() and that
+     * may attempt to use then then non-NULL but partially set up file
+     * object. */
     if (rv == APR_SUCCESS) {
-        apr_file_open(&file_stderr, logpath, APR_APPEND|APR_WRITE|APR_CREATE,
+        apr_file_open(&debug_log, logpath, APR_APPEND|APR_WRITE|APR_CREATE,
                       APR_OS_DEFAULT, global_pool);
     }
     else {
-        apr_file_open_stderr(&file_stderr, global_pool);
+        apr_file_open_stderr(&debug_log, global_pool);
     }
+
+    /* debug_log is now a file handle. */
+    file_stderr = debug_log;
 
     if (file_stderr) {
         apr_file_printf(file_stderr,



Mime
View raw message