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 di...@apache.org on 2008/04/23 07:07:14 UTC

svn commit: r650747 - in /webservices/axis2/trunk/c/src: core/addr/msg_info_headers.c core/clientapi/options.c core/context/msg_ctx.c modules/mod_addr/addr_in_handler.c

Author: dinesh
Date: Tue Apr 22 22:07:11 2008
New Revision: 650747

URL: http://svn.apache.org/viewvc?rev=650747&view=rev
Log:
fixed memory leaks in echo sample

Modified:
    webservices/axis2/trunk/c/src/core/addr/msg_info_headers.c
    webservices/axis2/trunk/c/src/core/clientapi/options.c
    webservices/axis2/trunk/c/src/core/context/msg_ctx.c
    webservices/axis2/trunk/c/src/modules/mod_addr/addr_in_handler.c

Modified: webservices/axis2/trunk/c/src/core/addr/msg_info_headers.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/addr/msg_info_headers.c?rev=650747&r1=650746&r2=650747&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/addr/msg_info_headers.c (original)
+++ webservices/axis2/trunk/c/src/core/addr/msg_info_headers.c Tue Apr 22 22:07:11 2008
@@ -267,6 +267,10 @@
     const axutil_env_t * env,
     axis2_relates_to_t * relates_to)
 {
+    if (msg_info_headers->relates_to)
+    {
+        axis2_relates_to_free (msg_info_headers->relates_to, env);
+    }
     msg_info_headers->relates_to = relates_to;
     return AXIS2_SUCCESS;
 }

Modified: webservices/axis2/trunk/c/src/core/clientapi/options.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/clientapi/options.c?rev=650747&r1=650746&r2=650747&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/clientapi/options.c (original)
+++ webservices/axis2/trunk/c/src/core/clientapi/options.c Tue Apr 22 22:07:11 2008
@@ -710,6 +710,11 @@
     const axutil_env_t * env,
     axis2_msg_info_headers_t * msg_info_headers)
 {
+    if (options->msg_info_headers)
+    {
+        axis2_msg_info_headers_free (options->msg_info_headers, env);
+    }
+
     options->msg_info_headers = msg_info_headers;
     return AXIS2_SUCCESS;
 }

Modified: webservices/axis2/trunk/c/src/core/context/msg_ctx.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/context/msg_ctx.c?rev=650747&r1=650746&r2=650747&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/context/msg_ctx.c (original)
+++ webservices/axis2/trunk/c/src/core/context/msg_ctx.c Tue Apr 22 22:07:11 2008
@@ -171,6 +171,10 @@
     /** Index into the current Phase of the currently executing handler (if any)*/
     int current_phase_index;
 
+    /* axis2 options container */
+
+    axis2_options_t *options;
+
     /**
      * Finds the service to be invoked. This function is used by dispatchers 
      * to locate the service to be invoked.
@@ -230,6 +234,7 @@
         return NULL;
     }
 
+    memset ((void *)msg_ctx, 0, sizeof (axis2_msg_ctx_t));
     msg_ctx->base = NULL;
     msg_ctx->process_fault = AXIS2_FALSE;
     msg_ctx->msg_info_headers = NULL;
@@ -291,7 +296,7 @@
     msg_ctx->auth_type = NULL;
     msg_ctx->no_content = AXIS2_FALSE;
     msg_ctx->status_code = 0;
-
+    msg_ctx->options = NULL;
     msg_ctx->base = axis2_ctx_create(env);
     if (!(msg_ctx->base))
     {
@@ -524,6 +529,14 @@
         axutil_array_list_free(msg_ctx->supported_rest_http_methods, env);
     }
 
+    if (msg_ctx->options)
+    {
+        /* freeing only axis2_options_t allocated space, should not
+         * call axis2_options_free because it will free internal
+         * properties as well. */
+        AXIS2_FREE (env->allocator, msg_ctx->options);
+    }
+
     AXIS2_FREE(env->allocator, msg_ctx);
 
     return;
@@ -1833,15 +1846,23 @@
     axis2_msg_ctx_t * msg_ctx,
     const axutil_env_t * env)
 {
-    axis2_options_t *options = NULL;
     axutil_hash_t *properties = NULL;
     AXIS2_PARAM_CHECK (env->error, msg_ctx, NULL);
 
-    options = axis2_options_create(env);
-    axis2_options_set_msg_info_headers(options, env, msg_ctx->msg_info_headers);
+    if (!msg_ctx->options)
+    {
+        msg_ctx->options = axis2_options_create(env);
+
+        if (!msg_ctx->options)
+        {
+            return NULL;
+        }
+    }
+
+    axis2_options_set_msg_info_headers(msg_ctx->options, env, msg_ctx->msg_info_headers);
     properties = axis2_ctx_get_property_map(msg_ctx->base, env);
-    axis2_options_set_properties(options, env, properties);
-    return options;
+    axis2_options_set_properties(msg_ctx->options, env, properties);
+    return msg_ctx->options;
 }
 
 axis2_status_t AXIS2_CALL

Modified: webservices/axis2/trunk/c/src/modules/mod_addr/addr_in_handler.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/modules/mod_addr/addr_in_handler.c?rev=650747&r1=650746&r2=650747&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/modules/mod_addr/addr_in_handler.c (original)
+++ webservices/axis2/trunk/c/src/modules/mod_addr/addr_in_handler.c Tue Apr 22 22:07:11 2008
@@ -508,6 +508,7 @@
                                        header_block_node);
             relates_to =
                 axis2_relates_to_create(env, address, relationship_type_value);
+
             axis2_msg_info_headers_set_relates_to(msg_info_headers, env,
                                                   relates_to);
             axiom_soap_header_block_set_processed(header_block, env);



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