Here's the patch keeping the original structure but using a cleanup to
destroy the pool reference. If it works, I would like that better.

Regards,

Rainer
Index: jk_connect.c
===================================================================
--- jk_connect.c        (revision 763986)
+++ jk_connect.c        (working copy)
@@ -35,7 +35,7 @@
 #include "apr_errno.h"
 #include "apr_general.h"
 #include "apr_pools.h"
-static apr_pool_t *jk_apr_pool = NULL;
+static apr_pool_t *jk_resolv_pool = NULL;
 #endif

 #ifdef HAVE_SYS_FILIO_H
@@ -58,6 +58,13 @@
 typedef const char* SET_TYPE;
 #endif

+static apr_status_t jk_resolv_cleanup(void *d)
+{
+        /* Clean up pointer content */
+        *(apr_pool_t **)d = NULL;
+        return APR_SUCCESS;
+}
+
 /** Set socket to blocking
  * @param sd  socket to manipulate
  * @return    errno: fcntl returns -1 (!WIN32)
@@ -343,15 +350,18 @@
         apr_sockaddr_t *remote_sa, *temp_sa;
         char *remote_ipaddr;

-        if (!jk_apr_pool) {
-            if (apr_pool_create(&jk_apr_pool, (apr_pool_t *)pool) != 
APR_SUCCESS) {
+        if (!jk_resolv_pool) {
+            if (apr_pool_create(&jk_resolv_pool, (apr_pool_t *)pool) != 
APR_SUCCESS) {
                 JK_TRACE_EXIT(l);
                 return JK_FALSE;
             }
         }
-        apr_pool_clear(jk_apr_pool);
+        /* We need to clear the pool reference, if the pool gets destroyed
+         * via its parent pool. */
+        apr_pool_cleanup_register(jk_resolv_pool, &jk_resolv_pool, 
jk_resolv_cleanup, jk_resolv_cleanup);
+        apr_pool_clear(jk_resolv_pool);
         if (apr_sockaddr_info_get
-            (&remote_sa, host, APR_UNSPEC, (apr_port_t) port, 0, jk_apr_pool)
+            (&remote_sa, host, APR_UNSPEC, (apr_port_t) port, 0, 
jk_resolv_pool)
             != APR_SUCCESS) {
             JK_TRACE_EXIT(l);
             return JK_FALSE;

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to