You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by sa...@apache.org on 2006/03/24 06:52:19 UTC

svn commit: r388389 - in /webservices/axis2/trunk/c/modules/core/transport/http: receiver/http_server.c sender/http_transport_sender.c

Author: sahan
Date: Thu Mar 23 21:52:17 2006
New Revision: 388389

URL: http://svn.apache.org/viewcvs?rev=388389&view=rev
Log:
More leak fixes.

Modified:
    webservices/axis2/trunk/c/modules/core/transport/http/receiver/http_server.c
    webservices/axis2/trunk/c/modules/core/transport/http/sender/http_transport_sender.c

Modified: webservices/axis2/trunk/c/modules/core/transport/http/receiver/http_server.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/http/receiver/http_server.c?rev=388389&r1=388388&r2=388389&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/receiver/http_server.c (original)
+++ webservices/axis2/trunk/c/modules/core/transport/http/receiver/http_server.c Thu Mar 23 21:52:17 2006
@@ -35,6 +35,7 @@
 	axis2_http_svr_thread_t *svr_thread;
 	int port;
 	axis2_conf_ctx_t* conf_ctx;
+	axis2_conf_ctx_t* conf_ctx_private;
 };
 
 #define AXIS2_INTF_TO_IMPL(http_server) \
@@ -85,6 +86,7 @@
     
 	server_impl->svr_thread = NULL;
 	server_impl->conf_ctx = NULL;
+	server_impl->conf_ctx_private = NULL;
 	server_impl->port = port;
 		
     server_impl->http_server.ops = AXIS2_MALLOC((*env)->allocator,
@@ -97,12 +99,19 @@
 	}
     if(repo)
     {
-        server_impl->conf_ctx = build_conf_ctx(env, repo);
-	    if(NULL == server_impl->conf_ctx)
+        /**
+         * We first create a private conf ctx which is owned by this server
+         * we only free this private conf context. We should never free the
+         * server_impl->conf_ctx because it may own to any other object which
+         * may lead to double free
+         */ 
+        server_impl->conf_ctx_private = build_conf_ctx(env, repo);
+	    if(NULL == server_impl->conf_ctx_private)
 	    {
 		    axis2_http_server_free((axis2_transport_receiver_t*) server_impl, env);
             return NULL;		
     	}
+        server_impl->conf_ctx = server_impl->conf_ctx_private;
     }
     server_impl->http_server.ops->init = axis2_http_server_init;                        
     server_impl->http_server.ops->start = axis2_http_server_start;
@@ -129,11 +138,15 @@
 		server_impl->svr_thread = NULL;
 	}
     
-	if(NULL != server_impl->conf_ctx)
+	if(NULL != server_impl->conf_ctx_private)
 	{
-		AXIS2_CONF_CTX_FREE(server_impl->conf_ctx, env);
-		server_impl->conf_ctx = NULL;
+		AXIS2_CONF_CTX_FREE(server_impl->conf_ctx_private, env);
+		server_impl->conf_ctx_private = NULL;
 	}
+    /**
+     * Do not free this. It may own to some other object
+     */
+    server_impl->conf_ctx = NULL;
     
 	if(NULL != server->ops)
 	{

Modified: webservices/axis2/trunk/c/modules/core/transport/http/sender/http_transport_sender.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/http/sender/http_transport_sender.c?rev=388389&r1=388388&r2=388389&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/sender/http_transport_sender.c (original)
+++ webservices/axis2/trunk/c/modules/core/transport/http/sender/http_transport_sender.c Thu Mar 23 21:52:17 2006
@@ -337,6 +337,15 @@
 	AXIS2_OM_OUTPUT_FREE(om_output, env);
 	om_output = NULL;
 	xml_writer = NULL;
+
+    if(NULL != transport_url)
+    {
+        if(NULL != epr)
+        {
+            AXIS2_ENDPOINT_REF_FREE(epr, env);
+            epr = NULL;
+        }
+    }
 	/*
 	 * TODO handle errors
 	 */