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 ka...@apache.org on 2006/09/26 08:21:12 UTC

svn commit: r449924 - in /webservices/axis2/trunk/c: modules/core/clientapi/svc_client.c modules/core/transport/http/server/simple_axis2_server/http_server_main.c samples/client/echo/echo.c util/src/env.c util/src/qname.c

Author: kaushalye
Date: Mon Sep 25 23:21:08 2006
New Revision: 449924

URL: http://svn.apache.org/viewvc?view=rev&rev=449924
Log:
Applying patch for memory leaks fixed - JIRA AXIS2C-253

Modified:
    webservices/axis2/trunk/c/modules/core/clientapi/svc_client.c
    webservices/axis2/trunk/c/modules/core/transport/http/server/simple_axis2_server/http_server_main.c
    webservices/axis2/trunk/c/samples/client/echo/echo.c
    webservices/axis2/trunk/c/util/src/env.c
    webservices/axis2/trunk/c/util/src/qname.c

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=449924&r1=449923&r2=449924
==============================================================================
--- webservices/axis2/trunk/c/modules/core/clientapi/svc_client.c (original)
+++ webservices/axis2/trunk/c/modules/core/clientapi/svc_client.c Mon Sep 25 23:21:08 2006
@@ -554,7 +554,15 @@
     svc_client_impl = AXIS2_INTF_TO_IMPL(svc_client);
     mod_qname = axis2_qname_create(env, module_name, NULL, NULL);
 
-    module = AXIS2_CONF_GET_MODULE(svc_client_impl->conf, env, mod_qname);
+    if (mod_qname)
+    {
+        module = AXIS2_CONF_GET_MODULE(svc_client_impl->conf, env, mod_qname);
+
+        AXIS2_QNAME_FREE(mod_qname, env);
+        mod_qname = NULL;
+    }
+    else
+        return AXIS2_FAILURE;
 
     if (module)
     {

Modified: webservices/axis2/trunk/c/modules/core/transport/http/server/simple_axis2_server/http_server_main.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/modules/core/transport/http/server/simple_axis2_server/http_server_main.c?view=diff&rev=449924&r1=449923&r2=449924
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/server/simple_axis2_server/http_server_main.c (original)
+++ webservices/axis2/trunk/c/modules/core/transport/http/server/simple_axis2_server/http_server_main.c Mon Sep 25 23:21:08 2006
@@ -76,7 +76,7 @@
         allocator = env->allocator;
         axis2_env_free(env);
     }
-    axis2_allocator_free(allocator);
+    /*axis2_allocator_free(allocator);*/
     axiom_xml_reader_cleanup();
     _exit(status);
 }

Modified: webservices/axis2/trunk/c/samples/client/echo/echo.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/client/echo/echo.c?view=diff&rev=449924&r1=449923&r2=449924
==============================================================================
--- webservices/axis2/trunk/c/samples/client/echo/echo.c (original)
+++ webservices/axis2/trunk/c/samples/client/echo/echo.c Mon Sep 25 23:21:08 2006
@@ -34,6 +34,7 @@
     axis2_svc_client_t* svc_client = NULL;
     axiom_node_t *payload = NULL;
     axiom_node_t *ret_node = NULL;
+    /*axis2_allocator_t *allocator = NULL;*/
 
     /* Set up the environment */
     env = axis2_env_create_all("echo.log", AXIS2_LOG_LEVEL_TRACE);
@@ -114,11 +115,22 @@
         svc_client = NULL;
     }
 
+    /*if (env->allocator)
+    {
+        allocator = env->allocator;
+    }*/
+
     if (env)
     {
-        axis2_env_free(env);
+        axis2_env_free((axis2_env_t *) env);
         env = NULL;
     }
+
+    /*if (allocator)
+    {
+        AXIS2_FREE(allocator, allocator);
+        allocator = NULL;
+    }*/
 
     return 0;
 }

Modified: webservices/axis2/trunk/c/util/src/env.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/env.c?view=diff&rev=449924&r1=449923&r2=449924
==============================================================================
--- webservices/axis2/trunk/c/util/src/env.c (original)
+++ webservices/axis2/trunk/c/util/src/env.c Mon Sep 25 23:21:08 2006
@@ -49,17 +49,36 @@
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL  axis2_env_free(axis2_env_t *env)
 {
-    if (env && NULL != env->log)
-        AXIS2_LOG_FREE(env->allocator, env->log);
+    axis2_allocator_t *allocator = NULL;
+    
+    if (env && env->allocator)
+        allocator = env->allocator;
 
-    if (env && NULL != env->error)
+    if (env && env->log)
+    {
+        AXIS2_LOG_FREE(env->allocator, env->log);
+        env->log = NULL;
+    }
+    if (env && env->error)
+    {
         AXIS2_ERROR_FREE(env->error);
-
-    if (env && NULL != env->thread_pool)
+        env->error = NULL;
+    }
+    if (env && env->thread_pool)
+    {
         AXIS2_THREAD_POOL_FREE(env->thread_pool);
-
+        env->thread_pool = NULL;
+    }
     if (env)
-        free(env);
+    {
+        AXIS2_FREE(env->allocator, env);
+        env = NULL;
+    }
+    if (allocator)
+    {
+        AXIS2_FREE(allocator, allocator);
+        allocator = NULL;
+    }
 
     return 0;
 }

Modified: webservices/axis2/trunk/c/util/src/qname.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/qname.c?view=diff&rev=449924&r1=449923&r2=449924
==============================================================================
--- webservices/axis2/trunk/c/util/src/qname.c (original)
+++ webservices/axis2/trunk/c/util/src/qname.c Mon Sep 25 23:21:08 2006
@@ -217,7 +217,9 @@
     if (qname->ops)
     {
         AXIS2_FREE(env->allocator, qname->ops);
+        qname->ops = NULL;
     }
+
     AXIS2_FREE(env->allocator, qname_impl);
     return AXIS2_SUCCESS;
 



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