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/24 16:44:40 UTC

svn commit: r478900 - in /webservices/axis2/trunk/c: modules/core/clientapi/ modules/core/transport/http/sender/ samples/client/notify/ samples/user_guide/clients/

Author: samisa
Date: Fri Nov 24 07:44:38 2006
New Revision: 478900

URL: http://svn.apache.org/viewvc?view=rev&rev=478900
Log:
Fixed more memory leaks.

Modified:
    webservices/axis2/trunk/c/modules/core/clientapi/mep_client.c
    webservices/axis2/trunk/c/modules/core/clientapi/op_client.c
    webservices/axis2/trunk/c/modules/core/clientapi/svc_client.c
    webservices/axis2/trunk/c/modules/core/transport/http/sender/http_transport_sender.c
    webservices/axis2/trunk/c/samples/client/notify/notify_client.c
    webservices/axis2/trunk/c/samples/user_guide/clients/echo_blocking.c
    webservices/axis2/trunk/c/samples/user_guide/clients/echo_blocking_addr.c
    webservices/axis2/trunk/c/samples/user_guide/clients/echo_blocking_dual.c
    webservices/axis2/trunk/c/samples/user_guide/clients/echo_blocking_soap11.c
    webservices/axis2/trunk/c/samples/user_guide/clients/echo_non_blocking.c
    webservices/axis2/trunk/c/samples/user_guide/clients/echo_non_blocking_dual.c
    webservices/axis2/trunk/c/samples/user_guide/clients/echo_rest.c
    webservices/axis2/trunk/c/samples/user_guide/clients/echo_util.c

Modified: webservices/axis2/trunk/c/modules/core/clientapi/mep_client.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/modules/core/clientapi/mep_client.c?view=diff&rev=478900&r1=478899&r2=478900
==============================================================================
--- webservices/axis2/trunk/c/modules/core/clientapi/mep_client.c (original)
+++ webservices/axis2/trunk/c/modules/core/clientapi/mep_client.c Fri Nov 24 07:44:38 2006
@@ -631,6 +631,10 @@
         return NULL;
 
     status = AXIS2_ENGINE_SEND(engine, env, msg_ctx);
+    
+    AXIS2_ENGINE_FREE(engine, env);
+    engine = NULL;
+    
     if (status != AXIS2_SUCCESS)
         return NULL;
 

Modified: webservices/axis2/trunk/c/modules/core/clientapi/op_client.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/modules/core/clientapi/op_client.c?view=diff&rev=478900&r1=478899&r2=478900
==============================================================================
--- webservices/axis2/trunk/c/modules/core/clientapi/op_client.c (original)
+++ webservices/axis2/trunk/c/modules/core/clientapi/op_client.c Fri Nov 24 07:44:38 2006
@@ -500,6 +500,7 @@
         if (!engine)
             return AXIS2_FAILURE;
         AXIS2_ENGINE_SEND(engine, env, msg_ctx);
+        AXIS2_ENGINE_FREE(engine, env);
     }
     else
     {
@@ -725,7 +726,8 @@
     axis2_op_client_worker_func_args_t *args_list = NULL;
     axis2_op_ctx_t *op_ctx = NULL;
     axis2_msg_ctx_t *response = NULL;
-    const axis2_env_t *th_env = NULL;
+    axis2_env_t *th_env = NULL;
+    axis2_thread_pool_t *th_pool = NULL;
 
     args_list = (axis2_op_client_worker_func_args_t *) data;
     if (!args_list)
@@ -742,10 +744,28 @@
 
     /* send the request and wait for response */
     response = axis2_mep_client_two_way_send(th_env, args_list->msg_ctx);
+
+    axis2_op_client_add_msg_ctx(&(args_list->op_client_impl->op_client), th_env,
+        response);
     args_list->op_client_impl->async_result = axis2_async_result_create(th_env, response);
     AXIS2_CALLBACK_INVOKE_ON_COMPLETE(args_list->callback, th_env, args_list->op_client_impl->async_result);
     AXIS2_CALLBACK_SET_COMPLETE(args_list->callback, th_env, AXIS2_TRUE);
 
+    /* clean up memory */
+    AXIS2_ASYNC_RESULT_FREE(args_list->op_client_impl->async_result, th_env);
+    
+    AXIS2_OP_CTX_FREE(op_ctx, th_env);
+        
+    th_pool = th_env->thread_pool;
+    
+    AXIS2_FREE(th_env->allocator, args_list);
+    
+    if (th_env)
+    {
+        axis2_free_thread_env(th_env);
+        th_env = NULL;
+    }
+    AXIS2_THREAD_POOL_EXIT_THREAD(th_pool, thd);
     return 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=478900&r1=478899&r2=478900
==============================================================================
--- webservices/axis2/trunk/c/modules/core/clientapi/svc_client.c (original)
+++ webservices/axis2/trunk/c/modules/core/clientapi/svc_client.c Fri Nov 24 07:44:38 2006
@@ -668,6 +668,8 @@
     axis2_svc_client_impl_t *svc_client_impl = NULL;
     axis2_op_client_t *op_client = NULL;
     axis2_msg_ctx_t *msg_ctx = NULL;
+    axis2_status_t status = AXIS2_FAILURE;
+    axis2_bool_t qname_free_flag = AXIS2_FALSE;
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
 
@@ -676,6 +678,7 @@
     if (!op_qname)
     {
         op_qname = axis2_qname_create(env, AXIS2_ANON_ROBUST_OUT_ONLY_OP, NULL, NULL);
+        qname_free_flag = AXIS2_TRUE;
     }
 
     msg_ctx = axis2_msg_ctx_create(env,
@@ -702,7 +705,15 @@
     svc_client_impl->op_client = op_client;
 
     AXIS2_OP_CLIENT_ADD_OUT_MSG_CTX(op_client, env, msg_ctx);
-    return AXIS2_OP_CLIENT_EXECUTE(op_client, env, AXIS2_TRUE);
+    status = AXIS2_OP_CLIENT_EXECUTE(op_client, env, AXIS2_TRUE);
+    
+    if (qname_free_flag)
+    {
+        AXIS2_QNAME_FREE((axis2_qname_t *) op_qname, env);
+        op_qname = NULL;
+    }
+
+    return status;
 }
 
 void AXIS2_CALL
@@ -715,6 +726,7 @@
     axis2_svc_client_impl_t *svc_client_impl = NULL;
     axis2_op_client_t *op_client = NULL;
     axis2_msg_ctx_t *msg_ctx = NULL;
+    axis2_bool_t qname_free_flag = AXIS2_FALSE;
 
     if (!env)
         return;
@@ -724,6 +736,7 @@
     if (!op_qname)
     {
         op_qname = axis2_qname_create(env, AXIS2_ANON_OUT_ONLY_OP, NULL, NULL);
+        qname_free_flag = AXIS2_TRUE;
     }
 
     msg_ctx = axis2_msg_ctx_create(env,
@@ -751,6 +764,13 @@
 
     AXIS2_OP_CLIENT_ADD_OUT_MSG_CTX(op_client, env, msg_ctx);
     AXIS2_OP_CLIENT_EXECUTE(op_client, env, AXIS2_FALSE);
+    
+    if (qname_free_flag)
+    {
+        AXIS2_QNAME_FREE((axis2_qname_t *) op_qname, env);
+        op_qname = NULL;
+    }
+
     return;
 }
 
@@ -938,12 +958,14 @@
     axis2_op_client_t *op_client = NULL;
     axis2_msg_ctx_t *msg_ctx = NULL;
     const axis2_char_t *transport_in_protocol = NULL;
+    axis2_bool_t qname_free_flag = AXIS2_FALSE;
 
     svc_client_impl = AXIS2_INTF_TO_IMPL(svc_client);
 
     if (!op_qname)
     {
         op_qname = axis2_qname_create(env, AXIS2_ANON_OUT_IN_OP, NULL, NULL);
+        qname_free_flag = AXIS2_TRUE;
     }
 
     msg_ctx = axis2_msg_ctx_create(env,
@@ -988,6 +1010,12 @@
     }
 
     AXIS2_OP_CLIENT_EXECUTE(op_client, env, AXIS2_FALSE);
+    
+    if (qname_free_flag)
+    {
+        AXIS2_QNAME_FREE((axis2_qname_t *) op_qname, env);
+        op_qname = NULL;
+    }
 
     return;
 }

Modified: webservices/axis2/trunk/c/modules/core/transport/http/sender/http_transport_sender.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/modules/core/transport/http/sender/http_transport_sender.c?view=diff&rev=478900&r1=478899&r2=478900
==============================================================================
--- 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 Fri Nov 24 07:44:38 2006
@@ -619,6 +619,8 @@
         AXIS2_REST_SENDER_SET_HTTP_VERSION(sender, env,
                 AXIS2_INTF_TO_IMPL(transport_sender)->http_version);
         status = AXIS2_REST_SENDER_SEND(sender, env, msg_ctx, data_out, url);
+
+        AXIS2_REST_SENDER_FREE(sender, env);
     }
     else
     {

Modified: webservices/axis2/trunk/c/samples/client/notify/notify_client.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/client/notify/notify_client.c?view=diff&rev=478900&r1=478899&r2=478900
==============================================================================
--- webservices/axis2/trunk/c/samples/client/notify/notify_client.c (original)
+++ webservices/axis2/trunk/c/samples/client/notify/notify_client.c Fri Nov 24 07:44:38 2006
@@ -109,6 +109,13 @@
         AXIS2_SVC_CLIENT_FREE(svc_client, env);
         svc_client = NULL;
     }
+
+    if (env)
+    {
+        axis2_env_free((axis2_env_t *) env);
+        env = NULL;
+    }
+
     return 0;
 }
 
@@ -126,7 +133,11 @@
     AXIOM_ELEMENT_SET_TEXT(notify_om_ele, env, "notify5", notify_om_node);
 
     buffer = AXIOM_NODE_TO_STRING(notify_om_node, env);
-    printf("\nSending OM node in XML : %s \n",  buffer);
+    if (buffer)
+    {
+        printf("\nSending OM node in XML : %s \n",  buffer);
+        AXIS2_FREE(env->allocator, buffer);
+    }
 
     return notify_om_node;
 }

Modified: webservices/axis2/trunk/c/samples/user_guide/clients/echo_blocking.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/user_guide/clients/echo_blocking.c?view=diff&rev=478900&r1=478899&r2=478900
==============================================================================
--- webservices/axis2/trunk/c/samples/user_guide/clients/echo_blocking.c (original)
+++ webservices/axis2/trunk/c/samples/user_guide/clients/echo_blocking.c Fri Nov 24 07:44:38 2006
@@ -88,7 +88,10 @@
         axis2_char_t *om_str = NULL;
         om_str = AXIOM_NODE_TO_STRING(ret_node, env);
         if (om_str)
+        {
             printf("\nReceived OM : %s\n", om_str);
+            AXIS2_FREE(env->allocator, om_str);
+        }
         printf("\necho client invoke SUCCESSFUL!\n");
     }
     else
@@ -103,6 +106,12 @@
     {
         AXIS2_SVC_CLIENT_FREE(svc_client, env);
         svc_client = NULL;
+    }
+
+    if (env)
+    {
+        axis2_env_free((axis2_env_t *) env);
+        env = NULL;
     }
 
     return 0;

Modified: webservices/axis2/trunk/c/samples/user_guide/clients/echo_blocking_addr.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/user_guide/clients/echo_blocking_addr.c?view=diff&rev=478900&r1=478899&r2=478900
==============================================================================
--- webservices/axis2/trunk/c/samples/user_guide/clients/echo_blocking_addr.c (original)
+++ webservices/axis2/trunk/c/samples/user_guide/clients/echo_blocking_addr.c Fri Nov 24 07:44:38 2006
@@ -93,7 +93,10 @@
         axis2_char_t *om_str = NULL;
         om_str = AXIOM_NODE_TO_STRING(ret_node, env);
         if (om_str)
+        {
             printf("\nReceived OM : %s\n", om_str);
+            AXIS2_FREE(env->allocator, om_str);
+        }
         printf("\necho client invoke SUCCESSFUL!\n");
     }
     else
@@ -109,5 +112,12 @@
         AXIS2_SVC_CLIENT_FREE(svc_client, env);
         svc_client = NULL;
     }
+
+    if (env)
+    {
+        axis2_env_free((axis2_env_t *) env);
+        env = NULL;
+    }
+    
     return 0;
 }

Modified: webservices/axis2/trunk/c/samples/user_guide/clients/echo_blocking_dual.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/user_guide/clients/echo_blocking_dual.c?view=diff&rev=478900&r1=478899&r2=478900
==============================================================================
--- webservices/axis2/trunk/c/samples/user_guide/clients/echo_blocking_dual.c (original)
+++ webservices/axis2/trunk/c/samples/user_guide/clients/echo_blocking_dual.c Fri Nov 24 07:44:38 2006
@@ -115,5 +115,11 @@
         svc_client = NULL;
     }
 
+    if (env)
+    {
+        axis2_env_free((axis2_env_t *) env);
+        env = NULL;
+    }
+ 
     return 0;
 }

Modified: webservices/axis2/trunk/c/samples/user_guide/clients/echo_blocking_soap11.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/user_guide/clients/echo_blocking_soap11.c?view=diff&rev=478900&r1=478899&r2=478900
==============================================================================
--- webservices/axis2/trunk/c/samples/user_guide/clients/echo_blocking_soap11.c (original)
+++ webservices/axis2/trunk/c/samples/user_guide/clients/echo_blocking_soap11.c Fri Nov 24 07:44:38 2006
@@ -89,7 +89,10 @@
         axis2_char_t *om_str = NULL;
         om_str = AXIOM_NODE_TO_STRING(ret_node, env);
         if (om_str)
+        {
             printf("\nReceived OM : %s\n", om_str);
+            AXIS2_FREE(env->allocator, om_str);
+        }
         printf("\necho client invoke SUCCESSFUL!\n");
     }
     else
@@ -104,6 +107,12 @@
     {
         AXIS2_SVC_CLIENT_FREE(svc_client, env);
         svc_client = NULL;
+    }
+
+    if (env)
+    {
+        axis2_env_free((axis2_env_t *) env);
+        env = NULL;
     }
 
     return 0;

Modified: webservices/axis2/trunk/c/samples/user_guide/clients/echo_non_blocking.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/user_guide/clients/echo_non_blocking.c?view=diff&rev=478900&r1=478899&r2=478900
==============================================================================
--- webservices/axis2/trunk/c/samples/user_guide/clients/echo_non_blocking.c (original)
+++ webservices/axis2/trunk/c/samples/user_guide/clients/echo_non_blocking.c Fri Nov 24 07:44:38 2006
@@ -134,6 +134,12 @@
         svc_client = NULL;
     }
 
+    if (env)
+    {
+        axis2_env_free((axis2_env_t *) env);
+        env = NULL;
+    }
+
     return 0;
 }
 
@@ -177,7 +183,10 @@
             axis2_char_t *om_str = NULL;
             om_str = AXIOM_NODE_TO_STRING(ret_node, env);
             if (om_str)
+            {
                 printf("\nReceived OM : %s\n", om_str);
+                AXIS2_FREE(env->allocator, om_str);
+            }
             printf("\necho client invoke SUCCESSFUL!\n");
         }
     }

Modified: webservices/axis2/trunk/c/samples/user_guide/clients/echo_non_blocking_dual.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/user_guide/clients/echo_non_blocking_dual.c?view=diff&rev=478900&r1=478899&r2=478900
==============================================================================
--- webservices/axis2/trunk/c/samples/user_guide/clients/echo_non_blocking_dual.c (original)
+++ webservices/axis2/trunk/c/samples/user_guide/clients/echo_non_blocking_dual.c Fri Nov 24 07:44:38 2006
@@ -147,6 +147,12 @@
         svc_client = NULL;
     }
 
+    if (env)
+    {
+        axis2_env_free((axis2_env_t *) env);
+        env = NULL;
+    }
+
     return 0;
 }
 

Modified: webservices/axis2/trunk/c/samples/user_guide/clients/echo_rest.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/user_guide/clients/echo_rest.c?view=diff&rev=478900&r1=478899&r2=478900
==============================================================================
--- webservices/axis2/trunk/c/samples/user_guide/clients/echo_rest.c (original)
+++ webservices/axis2/trunk/c/samples/user_guide/clients/echo_rest.c Fri Nov 24 07:44:38 2006
@@ -126,7 +126,10 @@
         axis2_char_t *om_str = NULL;
         om_str = AXIOM_NODE_TO_STRING(ret_node, env);
         if (om_str)
+        {
             printf("\nReceived OM : %s\n", om_str);
+            AXIS2_FREE(env->allocator, om_str);
+        }
         printf("\necho client invoke SUCCESSFUL!\n");
     }
     else

Modified: webservices/axis2/trunk/c/samples/user_guide/clients/echo_util.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/user_guide/clients/echo_util.c?view=diff&rev=478900&r1=478899&r2=478900
==============================================================================
--- webservices/axis2/trunk/c/samples/user_guide/clients/echo_util.c (original)
+++ webservices/axis2/trunk/c/samples/user_guide/clients/echo_util.c Fri Nov 24 07:44:38 2006
@@ -35,6 +35,7 @@
     om_str = AXIOM_NODE_TO_STRING(echo_om_node, env);
     if (om_str)
         printf("\nSending OM : %s\n", om_str);
+    AXIS2_FREE(env->allocator, om_str);
 
     return echo_om_node;
 }



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