axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nand...@apache.org
Subject svn commit: r371790 - in /webservices/axis2/trunk/c: include/ modules/util/ modules/xml/om/ modules/xml/soap/ test/xml/om/ test/xml/soap/
Date Tue, 24 Jan 2006 03:46:36 GMT
Author: nandika
Date: Mon Jan 23 19:46:18 2006
New Revision: 371790

URL: http://svn.apache.org/viewcvs?rev=371790&view=rev
Log:
 memory leaks fixed

Modified:
    webservices/axis2/trunk/c/include/axis2_qname.h
    webservices/axis2/trunk/c/modules/util/qname.c
    webservices/axis2/trunk/c/modules/xml/om/om_children_qname_iterator.c
    webservices/axis2/trunk/c/modules/xml/om/om_element.c
    webservices/axis2/trunk/c/modules/xml/soap/soap12_builder_helper.c
    webservices/axis2/trunk/c/modules/xml/soap/soap_body.c
    webservices/axis2/trunk/c/modules/xml/soap/soap_builder.c
    webservices/axis2/trunk/c/modules/xml/soap/soap_envelope.c
    webservices/axis2/trunk/c/modules/xml/soap/soap_header.c
    webservices/axis2/trunk/c/test/xml/om/test_om.c
    webservices/axis2/trunk/c/test/xml/soap/test_soap.c

Modified: webservices/axis2/trunk/c/include/axis2_qname.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_qname.h?rev=371790&r1=371789&r2=371790&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_qname.h (original)
+++ webservices/axis2/trunk/c/include/axis2_qname.h Mon Jan 23 19:46:18 2006
@@ -83,6 +83,11 @@
     axis2_char_t* (AXIS2_CALL *get_localpart)(struct axis2_qname *qname,
                                               axis2_env_t **env);
                                               
+    /**
+     * returns a unique string created by concatanting namespace uri 
+     * and localpart .
+     * The returned char* is freed when qname free function is called.
+     */
     axis2_char_t* (AXIS2_CALL *to_string)(struct axis2_qname *qname,
                                           axis2_env_t **env);                           
                          
                                               

Modified: webservices/axis2/trunk/c/modules/util/qname.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/qname.c?rev=371790&r1=371789&r2=371790&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/qname.c (original)
+++ webservices/axis2/trunk/c/modules/util/qname.c Mon Jan 23 19:46:18 2006
@@ -67,6 +67,8 @@
     /**  prefix mandatory */
     axis2_char_t *prefix;
     
+    axis2_char_t *qname_string;
+    
 
 }axis2_qname_impl_t;
 
@@ -99,12 +101,16 @@
                                              sizeof (axis2_qname_impl_t));
     if (!qn)
     {
-        AXIS2_ERROR_SET_ERROR_NUMBER((*env)->error, AXIS2_ERROR_NO_MEMORY);
-        AXIS2_ERROR_SET_STATUS_CODE((*env)->error, AXIS2_FAILURE);
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
     }
     /* set properties */
-
+    qn->localpart = NULL;
+    qn->qname_string = NULL;
+    qn->prefix = NULL;
+    qn->namespace_uri = NULL;
+    
+    
     qn->localpart = (axis2_char_t *)AXIS2_STRDUP (localpart, env);
     if (!(qn->localpart))
     {
@@ -201,6 +207,11 @@
         AXIS2_FREE ((*env)->allocator, qname_impl->prefix);
         qname_impl->prefix = NULL;
     }
+    if(qname_impl->qname_string)
+    {
+        AXIS2_FREE((*env)->allocator, qname_impl->qname_string);
+        qname_impl->qname_string = NULL;        
+    }
     if (qname->ops)
     {
         AXIS2_FREE ((*env)->allocator, qname->ops);
@@ -304,9 +315,17 @@
     axis2_qname_impl_t *qname_impl = NULL;
     AXIS2_FUNC_PARAM_CHECK(qname, env, NULL);
     qname_impl = AXIS2_INTF_TO_IMPL(qname);
-    
+    if(qname_impl->qname_string)
+    {
+        return qname_impl->qname_string;
+    }
     if(!(qname_impl->namespace_uri) || AXIS2_STRCMP(qname_impl->namespace_uri,"") ==
0)
-        return AXIS2_STRDUP(qname_impl->localpart, env);
+    {
+        qname_impl->qname_string = AXIS2_STRDUP(qname_impl->localpart, env);
+    }
     else 
-        return AXIS2_STRACAT( qname_impl->namespace_uri, qname_impl->localpart, env);
+    {
+        qname_impl->qname_string = AXIS2_STRACAT( qname_impl->namespace_uri, qname_impl->localpart,
env);
+    }
+    return qname_impl->qname_string;        
 }

Modified: webservices/axis2/trunk/c/modules/xml/om/om_children_qname_iterator.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/om_children_qname_iterator.c?rev=371790&r1=371789&r2=371790&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/om_children_qname_iterator.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/om_children_qname_iterator.c Mon Jan 23 19:46:18
2006
@@ -111,7 +111,8 @@
     iterator_impl->current_child = current_child;
     if(given_qname)
     {
-        iterator_impl->given_qname = AXIS2_QNAME_CLONE(given_qname, env);  
+     /*   iterator_impl->given_qname = AXIS2_QNAME_CLONE(given_qname, env);  */
+         iterator_impl->given_qname = given_qname;
     }
     iterator_impl->iterator.ops->free_fn = 
             axis2_om_children_qname_iterator_free;
@@ -135,12 +136,13 @@
     
     if(iterator->ops)
         AXIS2_FREE((*env)->allocator, iterator->ops);
-    
+    /*
     if(iterator_impl->given_qname)
     {
         AXIS2_QNAME_FREE(iterator_impl->given_qname, env);
         iterator_impl->given_qname = NULL;
     }
+    */
     AXIS2_FREE((*env)->allocator, iterator_impl);
     return AXIS2_SUCCESS;
 }

Modified: webservices/axis2/trunk/c/modules/xml/om/om_element.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/om_element.c?rev=371790&r1=371789&r2=371790&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/om_element.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/om_element.c Mon Jan 23 19:46:18 2006
@@ -639,7 +639,6 @@
     name = AXIS2_QNAME_TO_STRING(qname, env);
     attr = (axis2_om_attribute_t*) (axis2_hash_get(AXIS2_INTF_TO_IMPL(
         om_element)->attributes, name, AXIS2_HASH_KEY_STRING));
-    AXIS2_FREE((*env)->allocator, name);
     return attr;
 }
 

Modified: webservices/axis2/trunk/c/modules/xml/soap/soap12_builder_helper.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/soap/soap12_builder_helper.c?rev=371790&r1=371789&r2=371790&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/soap/soap12_builder_helper.c (original)
+++ webservices/axis2/trunk/c/modules/xml/soap/soap12_builder_helper.c Mon Jan 23 19:46:18
2006
@@ -521,6 +521,7 @@
                     AXIS2_SOAP_FAULT_VALUE_SET_BASE_NODE(value, env, om_ele_node);
                     AXIS2_SOAP_FAULT_VALUE_SET_SOAP_VERSION(value, env, AXIS2_SOAP12);
                     AXIS2_SOAP_FAULT_SUB_CODE_SET_VALUE(sub_code, env, value);
+             
                     builder_helper_impl->subcode_value_present = AXIS2_TRUE;
                     builder_helper_impl->sub_sub_code_present = AXIS2_FALSE;
                     builder_helper_impl->sub_code_processing = AXIS2_FALSE;

Modified: webservices/axis2/trunk/c/modules/xml/soap/soap_body.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/soap/soap_body.c?rev=371790&r1=371789&r2=371790&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/soap/soap_body.c (original)
+++ webservices/axis2/trunk/c/modules/xml/soap/soap_body.c Mon Jan 23 19:46:18 2006
@@ -187,19 +187,16 @@
     axis2_soap_body_impl_t *body_impl = NULL;
     AXIS2_FUNC_PARAM_CHECK(body, env, AXIS2_FAILURE);
     body_impl = AXIS2_INTF_TO_IMPL(body);
-    
+    if(body_impl->soap_fault)
+    {
+        AXIS2_SOAP_FAULT_FREE(body_impl->soap_fault, env);
+        body_impl->soap_fault = NULL;        
+    }
     if(body->ops)
     {
         AXIS2_FREE((*env)->allocator, body->ops);
         body->ops = NULL;
     }
-    
-    if(body_impl->om_ele_node)
-    {
-        AXIS2_OM_NODE_FREE_TREE(body_impl->om_ele_node, env);
-        body_impl->om_ele_node = NULL;
-    }
-    
     AXIS2_FREE((*env)->allocator, body_impl);
     body_impl = NULL;
     return AXIS2_SUCCESS;
@@ -387,4 +384,4 @@
     body_impl = AXIS2_INTF_TO_IMPL(body);
     body_impl->soap_builder = builder;
     return AXIS2_SUCCESS;
-}                            
+}

Modified: webservices/axis2/trunk/c/modules/xml/soap/soap_builder.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/soap/soap_builder.c?rev=371790&r1=371789&r2=371790&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/soap/soap_builder.c (original)
+++ webservices/axis2/trunk/c/modules/xml/soap/soap_builder.c Mon Jan 23 19:46:18 2006
@@ -232,7 +232,7 @@
     builder_impl = AXIS2_INTF_TO_IMPL(builder);
     if(builder_impl->builder_helper)
     {
-     /*   if(builder_impl->soap_version == AXIS2_SOAP11 && builder_impl->builder_helper)
+        if(builder_impl->soap_version == AXIS2_SOAP11 && builder_impl->builder_helper)
         {
             AXIS2_SOAP11_BUILDER_HELPER_FREE((axis2_soap11_builder_helper_t *)(builder_impl->builder_helper),
env);
         }
@@ -240,7 +240,6 @@
         {
             AXIS2_SOAP12_BUILDER_HELPER_FREE((axis2_soap12_builder_helper_t *)(builder_impl->builder_helper),
env);
         }
-      */                
     }
     if(builder->ops)
     {
@@ -450,8 +449,10 @@
             AXIS2_SOAP_HEADER_SET_BASE_NODE(soap_header, env, om_element_node);
             AXIS2_SOAP_HEADER_SET_SOAP_VERSION(soap_header, env, builder_impl->soap_version);
             AXIS2_SOAP_ENVELOPE_SET_HEADER(builder_impl->soap_envelope, env, soap_header);
+            AXIS2_SOAP_HEADER_SET_BUILDER(soap_header, env, builder);
             status = axis2_soap_builder_process_namespace_data(builder, env, 
                                 om_element_node, AXIS2_TRUE);
+            
         }
         else if(AXIS2_STRCMP(ele_localname, AXIS2_SOAP_BODY_LOCAL_NAME) == 0)
         {

Modified: webservices/axis2/trunk/c/modules/xml/soap/soap_envelope.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/soap/soap_envelope.c?rev=371790&r1=371789&r2=371790&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/soap/soap_envelope.c (original)
+++ webservices/axis2/trunk/c/modules/xml/soap/soap_envelope.c Mon Jan 23 19:46:18 2006
@@ -242,13 +242,21 @@
     axis2_soap_envelope_impl_t *envelope_impl = NULL;
     AXIS2_FUNC_PARAM_CHECK(envelope, env, AXIS2_FAILURE);
     envelope_impl = AXIS2_INTF_TO_IMPL(envelope);
-    
+    if(envelope_impl->header)
+    {
+        AXIS2_SOAP_HEADER_FREE(envelope_impl->header, env);
+        envelope_impl->header = NULL;      
+    }
+    if(envelope_impl->body)
+    {
+        AXIS2_SOAP_BODY_FREE(envelope_impl->body, env); 
+        envelope_impl->body = NULL;        
+    }
     if(envelope->ops)
     {
         AXIS2_FREE((*env)->allocator, envelope->ops);
         envelope->ops = NULL;
     }
-    
     if(envelope_impl->om_ele_node)
     {
         AXIS2_OM_NODE_FREE_TREE(envelope_impl->om_ele_node, env);
@@ -676,5 +684,3 @@
     AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_INVALID_SOAP_VERSION, AXIS2_FAILURE);
     return NULL;
 }
-
-                                
\ No newline at end of file

Modified: webservices/axis2/trunk/c/modules/xml/soap/soap_header.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/soap/soap_header.c?rev=371790&r1=371789&r2=371790&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/soap/soap_header.c (original)
+++ webservices/axis2/trunk/c/modules/xml/soap/soap_header.c Mon Jan 23 19:46:18 2006
@@ -197,9 +197,24 @@
     axis2_soap_header_impl_t *header_impl = NULL;
     AXIS2_FUNC_PARAM_CHECK(header, env, AXIS2_FAILURE);
     header_impl = AXIS2_INTF_TO_IMPL(header);
+    
     if(header_impl->header_blocks)
     {
-        
+        axis2_hash_index_t *hi = NULL;
+        void *val = NULL;
+            
+        for (hi = axis2_hash_first (header_impl->header_blocks ,env); hi;
+                 hi = axis2_hash_next ( env, hi))
+        {
+               axis2_hash_this (hi, NULL, NULL, &val);
+
+                if (val)
+                   AXIS2_SOAP_HEADER_BLOCK_FREE((axis2_soap_header_block_t *)val, env);
+                val = NULL;
+                   
+         }
+        AXIS2_FREE((*env)->allocator, hi); 
+        axis2_hash_free (header_impl->header_blocks, env);
     }
     if(header->ops)
     {
@@ -438,5 +453,4 @@
     header_impl = AXIS2_INTF_TO_IMPL(header);
     header_impl->soap_builder = builder;
     return AXIS2_SUCCESS;
-}                              
-                                                             
+}

Modified: webservices/axis2/trunk/c/test/xml/om/test_om.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/test/xml/om/test_om.c?rev=371790&r1=371789&r2=371790&view=diff
==============================================================================
--- webservices/axis2/trunk/c/test/xml/om/test_om.c (original)
+++ webservices/axis2/trunk/c/test/xml/om/test_om.c Mon Jan 23 19:46:18 2006
@@ -125,24 +125,6 @@
             ele2 =(axis2_om_element_t*) AXIS2_OM_NODE_GET_DATA_ELEMENT(node2, &environment);
             if(ele2 && AXIS2_OM_ELEMENT_GET_LOCALNAME(ele2,&environment))
             {
-                if(0 == AXIS2_STRCMP("messageReceiver", AXIS2_OM_ELEMENT_GET_LOCALNAME(ele2,
&environment)))
-                {
-                    axis2_char_t *class_name = NULL;
-                    axis2_qname_t *class_qname = NULL;
-                    axis2_om_attribute_t *recv_name = NULL;
-
-                    printf("messageReceiver***********************\n");
-                    class_qname = axis2_qname_create(&environment, "class", NULL, NULL);
-                    printf("came1\n");
-                    recv_name = AXIS2_OM_ELEMENT_GET_ATTRIBUTE(ele2, &environment, class_qname);
-                    if(!recv_name)
-                    {
-                        printf("attribute is null\n");
-                    }
-                    class_name = AXIS2_OM_ATTRIBUTE_GET_VALUE(recv_name, &environment);
-                    printf("class name:%s\n", class_name);
-                    return 0;
-                }
                 printf("\n localname %s\n" , AXIS2_OM_ELEMENT_GET_LOCALNAME(ele2,&environment));

             }
                         
@@ -181,9 +163,6 @@
     AXIS2_OM_STAX_BUILDER_FREE(builder, &environment);
     if(buffer)
         AXIS2_FREE(environment->allocator, buffer); 
-    
-
-    
     printf ("\ndone\n");
     return 0;
 }
@@ -289,8 +268,10 @@
     
     environment = axis2_env_create_with_error_log(allocator, error,  axis_log);
     test_om_build (file_name);
-    test_om_serialize();
+/*    test_om_serialize(); */
+
     axis2_env_free(environment); 
+    free(allocator);
     return 0;
 }
 

Modified: webservices/axis2/trunk/c/test/xml/soap/test_soap.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/test/xml/soap/test_soap.c?rev=371790&r1=371789&r2=371790&view=diff
==============================================================================
--- webservices/axis2/trunk/c/test/xml/soap/test_soap.c (original)
+++ webservices/axis2/trunk/c/test/xml/soap/test_soap.c Mon Jan 23 19:46:18 2006
@@ -79,7 +79,8 @@
     
     om_builder = axis2_om_stax_builder_create(env, xml_reader);
     
-    om_doc = axis2_om_document_create(env, NULL, om_builder);
+    /*om_doc = axis2_om_document_create(env, NULL, om_builder); */
+    
     
     soap_builder = axis2_soap_builder_create(env, om_builder, uri);
     if(!soap_builder)
@@ -109,9 +110,7 @@
             printnode(om_node, env);
         }
     }
-    
-    
-    
+    AXIS2_OM_CHILDREN_QNAME_ITERATOR_FREE(children_iter, env);
     
     soap_body = AXIS2_SOAP_ENVELOPE_GET_BODY(soap_envelope, env);
     if (soap_body)
@@ -142,6 +141,13 @@
     AXIS2_SOAP_ENVELOPE_SERIALIZE(soap_envelope, env, om_output, AXIS2_FALSE);
     buffer = AXIS2_XML_WRITER_GET_XML(xml_writer, env);         
     printf("%s", buffer);
+    if(buffer)
+         AXIS2_FREE((*env)->allocator, buffer);
+    AXIS2_SOAP_ENVELOPE_FREE(soap_envelope, env);
+    AXIS2_SOAP_BUILDER_FREE(soap_builder, env);
+    AXIS2_OM_STAX_BUILDER_FREE(om_builder, env);
+    AXIS2_OM_OUTPUT_FREE(om_output, env);
+    
     return AXIS2_SUCCESS;
     
 }
@@ -192,6 +198,10 @@
     AXIS2_SOAP_ENVELOPE_SERIALIZE(soap_envelope, env, om_output, AXIS2_FALSE);
     buffer = AXIS2_XML_WRITER_GET_XML(xml_writer, env);         
     printf("%s \n",  buffer); 
+
+    AXIS2_SOAP_ENVELOPE_FREE(soap_envelope, env);
+
+
     return AXIS2_SUCCESS;
 }
 
@@ -221,9 +231,13 @@
     axis2_error_init();
     /*build_soap_programatically(&env);*/
     
-    
+   
     printf("\nbuild soap\n");
     build_soap(&env, filename,uri);
+    axis2_env_free(env); 
+    free(allocator);
+    env = NULL;
+    allocator = NULL;
     printf("\n");
 
     return 0;        



Mime
View raw message