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/11/28 09:57:44 UTC

svn commit: r479956 - in /webservices/axis2/trunk/c: axiom/src/attachments/mime_parser.c axiom/src/soap/soap_builder.c modules/core/clientapi/svc_client.c modules/core/transport/http/http_transport_utils.c

Author: samisa
Date: Tue Nov 28 00:57:43 2006
New Revision: 479956

URL: http://svn.apache.org/viewvc?view=rev&rev=479956
Log:
Fixed dual client (use seperate listner case) related memory leaks

Modified:
    webservices/axis2/trunk/c/axiom/src/attachments/mime_parser.c
    webservices/axis2/trunk/c/axiom/src/soap/soap_builder.c
    webservices/axis2/trunk/c/modules/core/clientapi/svc_client.c
    webservices/axis2/trunk/c/modules/core/transport/http/http_transport_utils.c

Modified: webservices/axis2/trunk/c/axiom/src/attachments/mime_parser.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/axiom/src/attachments/mime_parser.c?view=diff&rev=479956&r1=479955&r2=479956
==============================================================================
--- webservices/axis2/trunk/c/axiom/src/attachments/mime_parser.c (original)
+++ webservices/axis2/trunk/c/axiom/src/attachments/mime_parser.c Tue Nov 28 00:57:43 2006
@@ -473,7 +473,7 @@
                             int mime_id_len = 0;
                             mime_id_len = pos - id;
                             mime_id = AXIS2_MALLOC(env->allocator,
-                                    sizeof(axis2_char_t) * mime_id_len + 1);
+                                    sizeof(axis2_char_t) * mime_id_len + 1); /* this would be freed by SOAP builder*/
                             if (mime_id)
                             {
 

Modified: webservices/axis2/trunk/c/axiom/src/soap/soap_builder.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/axiom/src/soap/soap_builder.c?view=diff&rev=479956&r1=479955&r2=479956
==============================================================================
--- webservices/axis2/trunk/c/axiom/src/soap/soap_builder.c (original)
+++ webservices/axis2/trunk/c/axiom/src/soap/soap_builder.c Tue Nov 28 00:57:43 2006
@@ -287,6 +287,23 @@
     
     if (builder_impl->mime_body_parts)
     {
+        axis2_hash_index_t *hi = NULL;
+        void *val = NULL;
+        const void *key = NULL;
+        for (hi = axis2_hash_first(builder_impl->mime_body_parts, env);
+                hi; hi = axis2_hash_next(env, hi))
+        {
+            axis2_hash_this(hi, &key, NULL, &val);
+
+            if (key)
+            {
+                AXIS2_FREE(env->allocator, (char*)key);
+            }
+
+            val = NULL;
+            key = NULL;
+        }
+
         axis2_hash_free(builder_impl->mime_body_parts, env);
         builder_impl->mime_body_parts = NULL;
     }

Modified: webservices/axis2/trunk/c/modules/core/clientapi/svc_client.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/modules/core/clientapi/svc_client.c?view=diff&rev=479956&r1=479955&r2=479956
==============================================================================
--- webservices/axis2/trunk/c/modules/core/clientapi/svc_client.c (original)
+++ webservices/axis2/trunk/c/modules/core/clientapi/svc_client.c Tue Nov 28 00:57:43 2006
@@ -31,6 +31,7 @@
 #include <axis2_mep_client.h>
 #include "../description/axis2_client_utils.h"
 #include <platforms/axis2_platform_auto_sense.h>
+#include <stdio.h>
 
 typedef struct axis2_svc_client_impl
 {
@@ -815,6 +816,7 @@
     if (AXIS2_OPTIONS_GET_USE_SEPERATE_LISTENER(svc_client_impl->options, env))
     {
         axis2_callback_t *callback = NULL;
+        axis2_msg_ctx_t *msg_ctx = NULL;
         long index = 0;
 
         /* This means doing a Request-Response invocation using two channels.
@@ -837,7 +839,6 @@
             /*wait till the response arrives*/
             if (index-- >= 0)
             {
-                axis2_msg_ctx_t *msg_ctx = NULL;
                 AXIS2_USLEEP(10000);
                 msg_ctx = (axis2_msg_ctx_t *)AXIS2_OP_CLIENT_GET_MSG_CTX(
                             svc_client_impl->op_client, env,
@@ -874,6 +875,13 @@
         }
 
         soap_envelope = AXIS2_CALLBACK_GET_ENVELOPE(callback, env);
+
+        /* start of hack to get rid of memory leak */
+        msg_ctx = axis2_msg_ctx_create(env,
+                        AXIS2_SVC_CTX_GET_CONF_CTX(svc_client_impl->svc_ctx, env), NULL, NULL);
+        AXIS2_OP_CLIENT_ADD_MSG_CTX(svc_client_impl->op_client, env, msg_ctx);
+        AXIS2_MSG_CTX_SET_SOAP_ENVELOPE(msg_ctx, env, soap_envelope);
+        /* end of hack to get rid of memory leak */
 
         /* process the result of the invocation */
         if (!soap_envelope)

Modified: webservices/axis2/trunk/c/modules/core/transport/http/http_transport_utils.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/modules/core/transport/http/http_transport_utils.c?view=diff&rev=479956&r1=479955&r2=479956
==============================================================================
--- 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 Tue Nov 28 00:57:43 2006
@@ -176,6 +176,7 @@
     axis2_status_t status = AXIS2_FAILURE;
     axis2_hash_t *binary_data_map = NULL;
     axis2_char_t *soap_body_str = NULL;
+    axis2_stream_t *stream = NULL;
 
     AXIS2_PARAM_CHECK(env->error, msg_ctx, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, in_stream, AXIS2_FAILURE);
@@ -273,7 +274,6 @@
         if (mime_boundary)
         {
             axiom_mime_parser_t *mime_parser = NULL;
-            axis2_stream_t *stream = NULL;
             int soap_body_len = 0;
 
             mime_parser = axiom_mime_parser_create(env);
@@ -484,6 +484,13 @@
         AXIS2_FREE(env->allocator, soap_body_str);
         soap_body_str = NULL;
     }
+
+    if (stream)
+    {
+        AXIS2_STREAM_FREE(stream, env);
+        stream = NULL;
+    }
+    
     return status;
 }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org