You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sa...@apache.org on 2006/11/28 03:05:53 UTC

svn commit: r479844 - in /webservices/axis2/trunk/c: axiom/src/attachments/ axiom/src/om/ axiom/src/soap/ modules/core/transport/http/ modules/core/transport/http/sender/ samples/client/mtom/

Author: samisa
Date: Mon Nov 27 18:05:52 2006
New Revision: 479844

URL: http://svn.apache.org/viewvc?view=rev&rev=479844
Log:
Fixed more memory leaks; specially those related to MTOM stuff

Modified:
    webservices/axis2/trunk/c/axiom/src/attachments/data_handler.c
    webservices/axis2/trunk/c/axiom/src/attachments/mime_output.c
    webservices/axis2/trunk/c/axiom/src/attachments/mime_parser.c
    webservices/axis2/trunk/c/axiom/src/om/om_text.c
    webservices/axis2/trunk/c/axiom/src/soap/soap_builder.c
    webservices/axis2/trunk/c/modules/core/transport/http/http_transport_utils.c
    webservices/axis2/trunk/c/modules/core/transport/http/http_worker.c
    webservices/axis2/trunk/c/modules/core/transport/http/sender/soap_over_http_sender.c
    webservices/axis2/trunk/c/samples/client/mtom/mtom_client.c

Modified: webservices/axis2/trunk/c/axiom/src/attachments/data_handler.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/axiom/src/attachments/data_handler.c?view=diff&rev=479844&r1=479843&r2=479844
==============================================================================
--- webservices/axis2/trunk/c/axiom/src/attachments/data_handler.c (original)
+++ webservices/axis2/trunk/c/axiom/src/attachments/data_handler.c Mon Nov 27 18:05:52 2006
@@ -140,6 +140,24 @@
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     data_handler_impl = AXIS2_INTF_TO_IMPL(data_handler);
 
+    if (data_handler_impl->file_name)
+    {
+        AXIS2_FREE(env->allocator, data_handler_impl->file_name);
+        data_handler_impl->file_name = NULL;
+    }
+
+    if (data_handler_impl->mime_type)
+    {
+        AXIS2_FREE(env->allocator, data_handler_impl->mime_type);
+        data_handler_impl->mime_type = NULL;
+    }
+
+    if (data_handler_impl->buffer)
+    {
+        AXIS2_FREE(env->allocator, data_handler_impl->buffer);
+        data_handler_impl->buffer = NULL;
+    }
+
     if (data_handler->ops)
     {
         AXIS2_FREE(env->allocator, data_handler->ops);

Modified: webservices/axis2/trunk/c/axiom/src/attachments/mime_output.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/axiom/src/attachments/mime_output.c?view=diff&rev=479844&r1=479843&r2=479844
==============================================================================
--- webservices/axis2/trunk/c/axiom/src/attachments/mime_output.c (original)
+++ webservices/axis2/trunk/c/axiom/src/attachments/mime_output.c Mon Nov 27 18:05:52 2006
@@ -249,6 +249,10 @@
                 mime_body_part = axis2_create_mime_body_part(text, env);
                 axis2_write_body_part(mime_output, env, &temp_stream,
                         &temp_stream_size, mime_body_part, boundary);
+
+                AXIOM_MIME_BODY_PART_FREE(mime_body_part, env);
+                mime_body_part = NULL;
+
                 temp = output_stream_body_parts;
                 temp_size = output_stream_body_parts_size;
                 output_stream_body_parts_size = temp_size +
@@ -327,6 +331,8 @@
     {
         memcpy(stream_buffer + output_stream_start_size + output_stream_body_size,
                 soap_body_buffer, soap_body_buffer_size);
+        AXIS2_FREE(env->allocator, soap_body_buffer);
+        soap_body_buffer = NULL;
     }
 
     if (output_stream_body_parts)

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=479844&r1=479843&r2=479844
==============================================================================
--- webservices/axis2/trunk/c/axiom/src/attachments/mime_parser.c (original)
+++ webservices/axis2/trunk/c/axiom/src/attachments/mime_parser.c Mon Nov 27 18:05:52 2006
@@ -119,11 +119,19 @@
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     mime_parser_impl = AXIS2_INTF_TO_IMPL(mime_parser);
 
-    if (mime_parser_impl->mime_parts_map)
+    /* This map is passed on to SOAP builder, and SOAP builder take over the
+       ownership of the map */
+    /*if (mime_parser_impl->mime_parts_map)
     {
         axis2_hash_free(mime_parser_impl->mime_parts_map, env);
         mime_parser_impl->mime_parts_map = NULL;
-    }
+    }*/
+
+    /*if (mime_parser_impl->soap_body_str)
+    {
+        AXIS2_FREE(env->allocator, mime_parser_impl->soap_body_str);
+        mime_parser_impl->soap_body_str = NULL;
+    }*/
 
     if (mime_parser->ops)
     {
@@ -473,6 +481,10 @@
                                 memcpy(mime_id, id, mime_id_len);
                                 mime_id[mime_id_len] = '\0';
                                 data_handler = axiom_data_handler_create(env, NULL, type);
+                                
+                                AXIS2_FREE(env->allocator, type);
+                                type = NULL;
+                                
                                 AXIOM_DATA_HANDLER_SET_BINARY_DATA(data_handler, env,
                                         mime_binary, mime_binary_len);
                                 axis2_hash_set(mime_parser_impl->mime_parts_map, mime_id,
@@ -493,11 +505,11 @@
 
             }
 
-            /*if (body_mime)
+            if (body_mime)
             {
                 AXIS2_FREE(env->allocator, body_mime);
                 body_mime = NULL;
-            }*/
+            }
 
             body_mime = temp_body_mime;
             body_mime_len = temp_body_mime_len;
@@ -505,11 +517,17 @@
         }/*if (mime_parser_impl->mime_parts_map)*/
     }/* end while (!end_of_mime) */
 
-    /*if (body_mime)
+    if (body_mime)
     {
         AXIS2_FREE(env->allocator, body_mime);
         body_mime = NULL;
-    }*/
+    }
+    
+    if (root_mime)
+    {
+        AXIS2_FREE(env->allocator, root_mime);
+        root_mime = NULL;
+    }
 
     AXIS2_FREE(env->allocator, buffer);
     buffer = NULL;

Modified: webservices/axis2/trunk/c/axiom/src/om/om_text.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/axiom/src/om/om_text.c?view=diff&rev=479844&r1=479843&r2=479844
==============================================================================
--- webservices/axis2/trunk/c/axiom/src/om/om_text.c (original)
+++ webservices/axis2/trunk/c/axiom/src/om/om_text.c Mon Nov 27 18:05:52 2006
@@ -267,6 +267,12 @@
         text_impl->om_attribute = NULL;
     }
 
+    if (text_impl->data_handler)
+    {
+        AXIOM_DATA_HANDLER_FREE(text_impl->data_handler, env);
+        text_impl->data_handler = NULL;
+    }
+
     if (om_text->ops)
     {
         AXIS2_FREE(env->allocator, om_text->ops);

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=479844&r1=479843&r2=479844
==============================================================================
--- webservices/axis2/trunk/c/axiom/src/soap/soap_builder.c (original)
+++ webservices/axis2/trunk/c/axiom/src/soap/soap_builder.c Mon Nov 27 18:05:52 2006
@@ -284,6 +284,13 @@
         AXIOM_STAX_BUILDER_FREE(builder_impl->om_builder, env);
         builder_impl->om_builder = NULL;
     }
+    
+    if (builder_impl->mime_body_parts)
+    {
+        axis2_hash_free(builder_impl->mime_body_parts, env);
+        builder_impl->mime_body_parts = NULL;
+    }
+
 
     if (builder->ops)
     {
@@ -538,6 +545,7 @@
                             }
                         }
                     }
+                    AXIS2_QNAME_FREE(qname, env);
                 }
             }
         }

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=479844&r1=479843&r2=479844
==============================================================================
--- 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 Mon Nov 27 18:05:52 2006
@@ -293,14 +293,16 @@
             if (stream)
             {
                 AXIS2_STREAM_WRITE(stream, env, soap_body_str, soap_body_len);
-                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
+                /*AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
                     "axis2_http_transport_utils_process_http_post_request soap_body_str = %s...%d soap_body_len=%d", 
-                    soap_body_str, strlen(soap_body_str), soap_body_len);
+                    soap_body_str, strlen(soap_body_str), soap_body_len);*/
                 callback_ctx->in_stream = stream;
                 callback_ctx->chunked_stream = NULL;
                 callback_ctx->content_length = soap_body_len;
                 callback_ctx->unread_len = soap_body_len;
             }
+            AXIOM_MIME_PARSER_FREE(mime_parser, env);
+            mime_parser = NULL;
         }
         AXIS2_FREE(env->allocator, mime_boundary);
     }
@@ -1127,10 +1129,10 @@
                 callback_ctx->content_length = soap_body_len;
                 callback_ctx->unread_len = soap_body_len;
             }
+
+            AXIOM_MIME_PARSER_FREE(mime_parser, env);
+            mime_parser = NULL;
         }
-        /**
-         * TODO MTOM stuff - create builder and get envelope
-         */
     }
 
     if (AXIS2_TRUE != AXIS2_MSG_CTX_GET_DOING_REST(msg_ctx, env))

Modified: webservices/axis2/trunk/c/modules/core/transport/http/http_worker.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/modules/core/transport/http/http_worker.c?view=diff&rev=479844&r1=479843&r2=479844
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/http_worker.c (original)
+++ webservices/axis2/trunk/c/modules/core/transport/http/http_worker.c Mon Nov 27 18:05:52 2006
@@ -454,6 +454,7 @@
             in_msg_ctx = NULL;
             axis2_hash_set(msg_ctx_map, AXIS2_WSDL_MESSAGE_LABEL_IN_VALUE, AXIS2_HASH_KEY_STRING, NULL);
         }
+
     } /* Done freeing message contexts */
     
     msg_ctx = NULL;

Modified: webservices/axis2/trunk/c/modules/core/transport/http/sender/soap_over_http_sender.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/modules/core/transport/http/sender/soap_over_http_sender.c?view=diff&rev=479844&r1=479843&r2=479844
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/sender/soap_over_http_sender.c (original)
+++ webservices/axis2/trunk/c/modules/core/transport/http/sender/soap_over_http_sender.c Mon Nov 27 18:05:52 2006
@@ -442,14 +442,15 @@
 
     status_code = AXIS2_HTTP_CLIENT_SEND(sender_impl->client, env, request);
 
-    /*AXIS2_FREE(env->allocator, output_stream);
-    output_stream = NULL;*/
 
     AXIS2_FREE(env->allocator, buffer);
     buffer = NULL;
 
     AXIS2_HTTP_SIMPLE_REQUEST_FREE(request, env);
     request = NULL;
+    
+    AXIS2_FREE(env->allocator, output_stream);
+    output_stream = NULL;
 
     status_code = AXIS2_HTTP_CLIENT_RECIEVE_HEADER(sender_impl->client, env);
 

Modified: webservices/axis2/trunk/c/samples/client/mtom/mtom_client.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/client/mtom/mtom_client.c?view=diff&rev=479844&r1=479843&r2=479844
==============================================================================
--- webservices/axis2/trunk/c/samples/client/mtom/mtom_client.c (original)
+++ webservices/axis2/trunk/c/samples/client/mtom/mtom_client.c Mon Nov 27 18:05:52 2006
@@ -136,6 +136,12 @@
         svc_client = NULL;
     }
 
+    if (env)
+    {
+        axis2_env_free((axis2_env_t *) env);
+        env = NULL;
+    }
+
     return 0;
 
 }



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