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/20 07:15:42 UTC

svn commit: r387148 - in /webservices/axis2/trunk/c/modules: core/addr/msg_info_headers.c core/transport/http/http_transport_utils.c mod_addr/addr_in_handler.c

Author: sahan
Date: Sun Mar 19 22:15:40 2006
New Revision: 387148

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

Modified:
    webservices/axis2/trunk/c/modules/core/addr/msg_info_headers.c
    webservices/axis2/trunk/c/modules/core/transport/http/http_transport_utils.c
    webservices/axis2/trunk/c/modules/mod_addr/addr_in_handler.c

Modified: webservices/axis2/trunk/c/modules/core/addr/msg_info_headers.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/addr/msg_info_headers.c?rev=387148&r1=387147&r2=387148&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/addr/msg_info_headers.c (original)
+++ webservices/axis2/trunk/c/modules/core/addr/msg_info_headers.c Sun Mar 19 22:15:40 2006
@@ -276,7 +276,17 @@
                                                axis2_env_t **env, axis2_char_t *action) 
 {
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    AXIS2_INTF_TO_IMPL(msg_info_headers)->action = action;
+    if(NULL != AXIS2_INTF_TO_IMPL(msg_info_headers)->action)
+    {
+        AXIS2_FREE((*env)->allocator, AXIS2_INTF_TO_IMPL(msg_info_headers)->action);
+        AXIS2_INTF_TO_IMPL(msg_info_headers)->action = NULL;
+    }
+    AXIS2_INTF_TO_IMPL(msg_info_headers)->action = AXIS2_STRDUP(action, env);
+    if(NULL == AXIS2_INTF_TO_IMPL(msg_info_headers)->action)
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return AXIS2_FAILURE;
+    }
     return AXIS2_SUCCESS;
 }
 
@@ -401,6 +411,16 @@
         AXIS2_ARRAY_LIST_FREE(msg_info_headers_impl->ref_params, env);
         msg_info_headers_impl->ref_params = NULL;
     }    
+    if(NULL != AXIS2_INTF_TO_IMPL(msg_info_headers)->action)
+    {
+        AXIS2_FREE((*env)->allocator, AXIS2_INTF_TO_IMPL(msg_info_headers)->action);
+        AXIS2_INTF_TO_IMPL(msg_info_headers)->action = NULL;
+    }
+    if (msg_info_headers_impl->message_id)
+    {
+        AXIS2_FREE((*env)->allocator, msg_info_headers_impl->message_id);
+        msg_info_headers_impl->message_id = NULL;
+    }
     
     AXIS2_FREE((*env)->allocator, msg_info_headers_impl);
     msg_info_headers_impl = NULL;

Modified: webservices/axis2/trunk/c/modules/core/transport/http/http_transport_utils.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/http/http_transport_utils.c?rev=387148&r1=387147&r2=387148&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/http_transport_utils.c (original)
+++ webservices/axis2/trunk/c/modules/core/transport/http/http_transport_utils.c Sun Mar 19 22:15:40 2006
@@ -332,7 +332,7 @@
             axis2_soap_envelope_create_default_soap_envelope(env, AXIS2_SOAP12);
 		AXIS2_MSG_CTX_SET_SOAP_ENVELOPE(msg_ctx, env, def_envelope);
 	}
-    if(NULL == engine)
+    if(NULL != engine)
     {
         AXIS2_ENGINE_FREE(engine, env);
     }

Modified: webservices/axis2/trunk/c/modules/mod_addr/addr_in_handler.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/mod_addr/addr_in_handler.c?rev=387148&r1=387147&r2=387148&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/mod_addr/addr_in_handler.c (original)
+++ webservices/axis2/trunk/c/modules/mod_addr/addr_in_handler.c Sun Mar 19 22:15:40 2006
@@ -384,16 +384,21 @@
         }
         else if(AXIS2_STRCMP(ele_localname, AXIS2_WSA_MESSAGE_ID) == 0)
         {
-            AXIS2_MSG_INFO_HEADERS_SET_MESSAGE_ID(msg_info_headers, env, 
-                AXIS2_OM_ELEMENT_GET_TEXT(header_block_ele, env, header_block_node));
+            axis2_char_t *text = NULL;
+            text = AXIS2_OM_ELEMENT_GET_TEXT(header_block_ele, env, header_block_node);
+            AXIS2_MSG_INFO_HEADERS_SET_MESSAGE_ID(msg_info_headers, env, text);
             AXIS2_SOAP_HEADER_BLOCK_SET_PRECESSED(header_block, env);              
+            if(NULL != text)
+                AXIS2_FREE((*env)->allocator, text);
         }
         else if(AXIS2_STRCMP(ele_localname, AXIS2_WSA_ACTION) == 0)
         {
-            AXIS2_MSG_INFO_HEADERS_SET_ACTION(msg_info_headers, env, 
-                AXIS2_OM_ELEMENT_GET_TEXT(header_block_ele, env, header_block_node));
+            axis2_char_t *text = NULL;
+            text = AXIS2_OM_ELEMENT_GET_TEXT(header_block_ele, env, header_block_node);
+            AXIS2_MSG_INFO_HEADERS_SET_ACTION(msg_info_headers, env, text); 
             AXIS2_SOAP_HEADER_BLOCK_SET_PRECESSED(header_block, env);       
-            
+            if(NULL != text)
+                AXIS2_FREE((*env)->allocator, text);
         }
         else if(AXIS2_STRCMP(ele_localname, AXIS2_WSA_RELATES_TO) == 0)
         {