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:20:22 UTC

svn commit: r650749 - /webservices/axis2/trunk/c/samples/client/google/google_client.c

Author: dinesh
Date: Tue Apr 22 22:20:21 2008
New Revision: 650749

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

Modified:
    webservices/axis2/trunk/c/samples/client/google/google_client.c

Modified: webservices/axis2/trunk/c/samples/client/google/google_client.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/client/google/google_client.c?rev=650749&r1=650748&r2=650749&view=diff
==============================================================================
--- webservices/axis2/trunk/c/samples/client/google/google_client.c (original)
+++ webservices/axis2/trunk/c/samples/client/google/google_client.c Tue Apr 22 22:20:21 2008
@@ -126,20 +126,41 @@
         axiom_soap_envelope_t *soap_envelope = NULL;
         axiom_soap_body_t *soap_body = NULL;
         axiom_soap_fault_t *soap_fault = NULL;
+        axis2_char_t *fault_string = NULL;
 
         printf("\nResponse has a SOAP fault\n");
         soap_envelope =
             axis2_svc_client_get_last_response_soap_envelope(svc_client, env);
         if (soap_envelope)
+        {
             soap_body = axiom_soap_envelope_get_body(soap_envelope, env);
+        }
+
         if (soap_body)
+        {
             soap_fault = axiom_soap_body_get_fault(soap_body, env);
+        }
+
         if (soap_fault)
         {
-            printf("\nReturned SOAP fault: %s\n",
-                   axiom_node_to_string(axiom_soap_fault_get_base_node
-                                        (soap_fault, env), env));
+            fault_string = axiom_node_to_string(axiom_soap_fault_get_base_node
+                                                (soap_fault, env), env);
+            printf("\nReturned SOAP fault: %s\n", fault_string);
+            AXIS2_FREE (env->allocator, fault_string);
+        }
+
+        if (svc_client)
+        {
+            axis2_svc_client_free(svc_client, env);
+            svc_client = NULL;
+        }
+
+        if (env)
+        {
+            axutil_env_free((axutil_env_t *) env);
+            env = NULL;
         }
+
         return -1;
     }
 
@@ -193,6 +214,12 @@
         svc_client = NULL;
     }
 
+    if (env)
+    {
+        axutil_env_free((axutil_env_t *) env);
+        env = NULL;
+    }
+
     return 0;
 }
 
@@ -248,6 +275,7 @@
 
     buffer = axiom_node_to_string(google_om_node, env);
     printf("%s\n", buffer);
+    AXIS2_FREE (env->allocator, buffer);
     return google_om_node;
 }
 



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