axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dami...@apache.org
Subject svn commit: r428221 - in /webservices/axis2/trunk/c: samples/client/dynamic_client/ util/src/ woden/samples/ woden/samples/wsdl10/ woden/src/builder/ woden/src/builder/wsdl10/ woden/src/wsdl10/
Date Thu, 03 Aug 2006 03:59:37 GMT
Author: damitha
Date: Wed Aug  2 20:59:36 2006
New Revision: 428221

URL: http://svn.apache.org/viewvc?rev=428221&view=rev
Log:
fixing memory leaks in woden

Modified:
    webservices/axis2/trunk/c/samples/client/dynamic_client/CalculatorDoc.wsdl
    webservices/axis2/trunk/c/util/src/uri.c
    webservices/axis2/trunk/c/woden/samples/test_wsdl2.c
    webservices/axis2/trunk/c/woden/samples/wsdl10/test_wsdl1.c
    webservices/axis2/trunk/c/woden/src/builder/resolver.c
    webservices/axis2/trunk/c/woden/src/builder/wsdl10/wsdl10_reader.c
    webservices/axis2/trunk/c/woden/src/wsdl10/desc.c

Modified: webservices/axis2/trunk/c/samples/client/dynamic_client/CalculatorDoc.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/samples/client/dynamic_client/CalculatorDoc.wsdl?rev=428221&r1=428220&r2=428221&view=diff
==============================================================================
--- webservices/axis2/trunk/c/samples/client/dynamic_client/CalculatorDoc.wsdl (original)
+++ webservices/axis2/trunk/c/samples/client/dynamic_client/CalculatorDoc.wsdl Wed Aug  2
20:59:36 2006
@@ -246,7 +246,7 @@
 
       <wsdl:port binding="impl:CalculatorSoapBinding" name="Calculator">
 
-          <wsdlsoap:address location="http://localhost:5555/axis2/services/Calculator"/>
+          <wsdlsoap:address location="http://localhost:9090/axis2/services/Calculator"/>
 
       </wsdl:port>
 

Modified: webservices/axis2/trunk/c/util/src/uri.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/uri.c?rev=428221&r1=428220&r2=428221&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/uri.c (original)
+++ webservices/axis2/trunk/c/util/src/uri.c Wed Aug  2 20:59:36 2006
@@ -671,27 +671,27 @@
     /* The trivial bits are everything-but-path */
     if ( uri_impl->scheme == NULL ) 
     {
-        uri_impl->scheme = base_impl->scheme ;
+        uri_impl->scheme = AXIS2_STRDUP(base_impl->scheme, env) ;
     }
     if ( uri_impl->hostinfo == NULL ) 
     {
-        uri_impl->hostinfo = base_impl->hostinfo ;
+        uri_impl->hostinfo = AXIS2_STRDUP(base_impl->hostinfo, env) ;
     }
     if ( uri_impl->user == NULL ) 
     {
-        uri_impl->user = base_impl->user ;
+        uri_impl->user = AXIS2_STRDUP(base_impl->user, env) ;
     }
     if ( uri_impl->password == NULL ) 
     {
-        uri_impl->password = base_impl->password ;
+        uri_impl->password = AXIS2_STRDUP(base_impl->password, env) ;
     }
     if ( uri_impl->hostname == NULL ) 
     {
-        uri_impl->hostname = base_impl->hostname ;
+        uri_impl->hostname = AXIS2_STRDUP(base_impl->hostname, env) ;
     } 
     if ( uri_impl->port_str == NULL ) 
     {
-        uri_impl->port_str = base_impl->port_str ;
+        uri_impl->port_str = AXIS2_STRDUP(base_impl->port_str, env) ;
     }
     if ( uri_impl->hostent == NULL ) 
     {

Modified: webservices/axis2/trunk/c/woden/samples/test_wsdl2.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/woden/samples/test_wsdl2.c?rev=428221&r1=428220&r2=428221&view=diff
==============================================================================
--- webservices/axis2/trunk/c/woden/samples/test_wsdl2.c (original)
+++ webservices/axis2/trunk/c/woden/samples/test_wsdl2.c Wed Aug  2 20:59:36 2006
@@ -37,6 +37,7 @@
 {
     axis2_env_t *env = NULL;
     axiom_document_t *om_doc = NULL;
+    axiom_stax_builder_t *om_builder = NULL;
     axis2_char_t *doc_base_uri = NULL;
     axis2_char_t *axis2c_home = NULL;
     woden_resolver_t *resolver = NULL;
@@ -112,6 +113,10 @@
             }
         }
     }
+    om_builder = AXIOM_DOCUMENT_GET_BUILDER(om_doc, env);
+    AXIOM_STAX_BUILDER_FREE(om_builder, env);
+    WODEN_DESC_FREE(desc, env);
+    axis2_env_free(env);
     return 0;
 }
 
@@ -126,7 +131,7 @@
 
     reader = axiom_xml_reader_create_for_file(env, filename, NULL);
     om_builder = axiom_stax_builder_create(env, reader);
-    doc = axiom_document_create(env, NULL, om_builder); 
+    doc = AXIOM_STAX_BUILDER_GET_DOCUMENT(om_builder, env);
     AXIOM_DOCUMENT_BUILD_ALL(doc, env);
 
     return doc;    

Modified: webservices/axis2/trunk/c/woden/samples/wsdl10/test_wsdl1.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/woden/samples/wsdl10/test_wsdl1.c?rev=428221&r1=428220&r2=428221&view=diff
==============================================================================
--- webservices/axis2/trunk/c/woden/samples/wsdl10/test_wsdl1.c (original)
+++ webservices/axis2/trunk/c/woden/samples/wsdl10/test_wsdl1.c Wed Aug  2 20:59:36 2006
@@ -39,6 +39,7 @@
 {
     axis2_env_t *env = NULL;
     axiom_document_t *om_doc = NULL;
+    axiom_stax_builder_t *om_builder = NULL;
     axis2_char_t *doc_base_uri = NULL;
     axis2_char_t *axis2c_home = NULL;
     woden_resolver_t *resolver = NULL;
@@ -72,6 +73,8 @@
     resolver = woden_resolver_create(env);
     
     desc = WODEN_RESOLVER_READ(resolver, env, om_doc, doc_base_uri);
+    AXIS2_FREE(env->allocator, doc_base_uri);
+    WODEN_RESOLVER_FREE(resolver, env);
     intfaces = WODEN_WSDL10_DESC_GET_INTERFACES(desc, env);
     intface = AXIS2_ARRAY_LIST_GET(intfaces, env, 0);
     if (intface)
@@ -169,6 +172,10 @@
             printf("Content is:\n");
         }
     }
+    om_builder = AXIOM_DOCUMENT_GET_BUILDER(om_doc, env);
+    AXIOM_STAX_BUILDER_FREE(om_builder, env);
+    WODEN_WSDL10_DESC_FREE(desc, env);
+    axis2_env_free(env);
     return 0;
 }
 
@@ -183,7 +190,7 @@
 
     reader = axiom_xml_reader_create_for_file(env, filename, NULL);
     om_builder = axiom_stax_builder_create(env, reader);
-    doc = axiom_document_create(env, NULL, om_builder); 
+    doc = AXIOM_STAX_BUILDER_GET_DOCUMENT(om_builder, env);
     AXIOM_DOCUMENT_BUILD_ALL(doc, env);
 
     return doc;    

Modified: webservices/axis2/trunk/c/woden/src/builder/resolver.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/woden/src/builder/resolver.c?rev=428221&r1=428220&r2=428221&view=diff
==============================================================================
--- webservices/axis2/trunk/c/woden/src/builder/resolver.c (original)
+++ webservices/axis2/trunk/c/woden/src/builder/resolver.c Wed Aug  2 20:59:36 2006
@@ -228,6 +228,7 @@
         reader = woden_reader_create(env);
         desc = WODEN_READER_READ_WSDL(reader, env, resolver_impl->root_node, 
                 doc_base_uri); 
+        WODEN_READER_FREE(reader, env);
 
     }
     AXIS2_QNAME_FREE(qname, env);
@@ -241,6 +242,7 @@
         reader = woden_wsdl10_reader_create(env);
         desc = WODEN_WSDL10_READER_READ_WSDL(reader, env, resolver_impl->root_node, 
                 doc_base_uri); 
+        WODEN_WSDL10_READER_FREE(reader, env);
     }
     return desc;
 }

Modified: webservices/axis2/trunk/c/woden/src/builder/wsdl10/wsdl10_reader.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/woden/src/builder/wsdl10/wsdl10_reader.c?rev=428221&r1=428220&r2=428221&view=diff
==============================================================================
--- webservices/axis2/trunk/c/woden/src/builder/wsdl10/wsdl10_reader.c (original)
+++ webservices/axis2/trunk/c/woden/src/builder/wsdl10/wsdl10_reader.c Wed Aug  2 20:59:36
2006
@@ -136,7 +136,6 @@
     /* A map of imported schema definitions keyed by schema location URI */
     axis2_hash_t *f_imported_schemas;
     woden_wsdl10_ext_registry_t *f_ext_reg;
-    axis2_uri_t *f_uri;
 
 };
 
@@ -439,7 +438,6 @@
  */
 static axis2_uri_t *
 get_uri(
-        void *reader,
         const axis2_env_t *env,
         const axis2_char_t *uri_str);
 
@@ -455,7 +453,6 @@
 
     reader_impl->f_imported_schemas = NULL;
     reader_impl->f_ext_reg = NULL;
-    reader_impl->f_uri = NULL;
     
     reader_impl->reader.ops = AXIS2_MALLOC(env->allocator, 
                     sizeof(woden_wsdl10_reader_ops_t));
@@ -508,13 +505,7 @@
         WODEN_WSDL10_EXT_REGISTRY_FREE(reader_impl->f_ext_reg, env);
         reader_impl->f_ext_reg = NULL;
     }
-
-    if(reader_impl->f_uri)
-    {
-        AXIS2_URI_FREE(reader_impl->f_uri, env);
-        reader_impl->f_uri = NULL;
-    }
-
+    
     if((&(reader_impl->reader))->ops)
     {
         AXIS2_FREE(env->allocator, (&(reader_impl->reader))->ops);
@@ -618,7 +609,6 @@
     void *ext_reg = NULL;
     axis2_uri_t *uri = NULL;
     axis2_char_t *target_namespc = NULL;
-    axis2_uri_t *target_namespc_uri = NULL;
     axiom_element_t *desc_el = NULL;
     axis2_hash_t *attrs = NULL;
     axis2_hash_index_t *index = NULL;
@@ -662,8 +652,10 @@
         WODEN_WSDL10_DESC_ELEMENT_SET_EXT_REGISTRY(desc, env, ext_reg);
     }
   
-    uri = get_uri(reader, env, document_base_uri);
+    uri = get_uri(env, document_base_uri);
     WODEN_WSDL10_DESC_ELEMENT_SET_DOCUMENT_BASE_URI(desc, env, uri);
+    AXIS2_URI_FREE(uri, env);
+    uri = NULL;
 
     desc_el = AXIOM_NODE_GET_DATA_ELEMENT(desc_el_node, env);
     target_namespc = AXIOM_ELEMENT_GET_ATTRIBUTE_VALUE_BY_NAME(desc_el, 
@@ -671,8 +663,11 @@
     
     if(NULL != target_namespc)
     {
-        target_namespc_uri = get_uri(reader, env, target_namespc);
+        axis2_uri_t *target_namespc_uri = NULL;
+
+        target_namespc_uri = get_uri(env, target_namespc);
         WODEN_WSDL10_DESC_ELEMENT_SET_TARGET_NAMESPACE(desc, env, target_namespc_uri);
+        AXIS2_URI_FREE(target_namespc_uri, env);
     }
     
     /* parse the namespace declarations */
@@ -695,7 +690,7 @@
         namespc_uri = AXIOM_NAMESPACE_GET_URI(namespc, env);
         local_part = AXIOM_ATTRIBUTE_GET_LOCALNAME(attr, env);
         value = AXIOM_ATTRIBUTE_GET_VALUE(attr, env);
-        uri = get_uri(reader, env, value);
+        uri = get_uri(env, value);
         if(0 == AXIS2_STRCMP(WODEN_WSDL10_NS_URI_XMLNS, namespc_uri))
         {
             if(0 == AXIS2_STRCMP(WODEN_WSDL10_ATTR_XMLNS, local_part))
@@ -708,6 +703,8 @@
                 WODEN_WSDL10_DESC_ELEMENT_ADD_NAMESPACE(desc, env, NULL, uri); 
             }
         }
+        AXIS2_URI_FREE(uri, env);
+        uri = NULL;
 
     }
     desc = woden_wsdl10_desc_to_attr_extensible(desc, env); 
@@ -974,8 +971,9 @@
         axis2_uri_t *uri = NULL;
 
         /* TODO handle missing namespace attribute (REQUIRED attr) */
-        uri = get_uri(reader, env, namespc_uri);
+        uri = get_uri(env, namespc_uri);
         WODEN_IMPORT_SET_NAMESPACE(imp, env, uri);
+        AXIS2_URI_FREE(uri, env);
     }
     
     if(NULL != location_uri)
@@ -985,8 +983,9 @@
         
         /* TODO handle missing locationURI (OPTIONAL attr) */
         imp = woden_import_to_import_element(imp, env);
-        uri = get_uri(reader, env, location_uri);
+        uri = get_uri(env, location_uri);
         WODEN_IMPORT_ELEMENT_SET_LOCATION(imp, env, uri);
+        AXIS2_URI_FREE(uri, env);
         
         imported_desc = get_wsdl_from_location(reader, env, location_uri, desc, 
                 wsdl_modules);
@@ -1026,9 +1025,10 @@
         axis2_uri_t *uri = NULL;
         void *included_desc = NULL;
        
-        uri = get_uri(reader, env, location_uri);
+        uri = get_uri(env, location_uri);
         include = woden_include_to_include_element(include, env);
         WODEN_INCLUDE_ELEMENT_SET_LOCATION(include, env, uri);
+        AXIS2_URI_FREE(uri, env);
         
         included_desc = get_wsdl_from_location(reader, env, location_uri, desc, 
                 wsdl_modules);
@@ -1165,8 +1165,9 @@
     if(NULL != tns)
     {
         void *base = WODEN_INLINED_SCHEMA_GET_BASE_IMPL(schema, env);
-        axis2_uri_t *uri = get_uri(reader, env, tns);
+        axis2_uri_t *uri = get_uri(env, tns);
         WODEN_SCHEMA_SET_NAMESPACE(base, env, uri);
+        AXIS2_URI_FREE(uri, env);
     }
     desc = woden_wsdl10_desc_to_desc_element(desc, env);
     base_uri = WODEN_WSDL10_DESC_ELEMENT_GET_DOCUMENT_BASE_URI(desc, env);
@@ -1248,15 +1249,19 @@
             WODEN_WSDL10_ATTR_NAMESPACE);
     if(NULL != ns)
     {
-        uri = get_uri(reader, env, ns);
+        uri = get_uri(env, ns);
         WODEN_SCHEMA_SET_NAMESPACE(base_schema, env, uri);
+        AXIS2_URI_FREE(uri, env);
+        uri = NULL;
     }
     sloc = AXIOM_ELEMENT_GET_ATTRIBUTE_VALUE_BY_NAME(import_el, env, 
             WODEN_ATTR_SCHEMA_LOCATION);
     if(NULL != sloc)
     {
-        uri = get_uri(reader, env, sloc);
+        uri = get_uri(env, sloc);
         WODEN_IMPORTED_SCHEMA_SET_LOCATION(schema, env, uri);
+        AXIS2_URI_FREE(uri, env);
+        uri = NULL;
     }
         
     if(NULL == WODEN_SCHEMA_GET_NAMESPACE(base_schema, env))
@@ -1624,8 +1629,9 @@
             axis2_uri_t *uri = NULL;
             uri_str = AXIS2_ARRAY_LIST_GET(string_list, env, i);
             intface = woden_interface_to_interface_element(intface, env);
-            uri = get_uri(reader, env, uri_str);
+            uri = get_uri(env, uri_str);
             WODEN_INTERFACE_ELEMENT_ADD_STYLE_DEFAULT_URI(intface, env, uri);
+            AXIS2_URI_FREE(uri, env);
         }
     }
     
@@ -1780,9 +1786,10 @@
         for(i = 0; i < size; i++)
         {
             uri_str = AXIS2_ARRAY_LIST_GET(str_list, env, i);
-            uri = get_uri(reader, env, uri_str);
+            uri = get_uri(env, uri_str);
             op = woden_interface_op_to_interface_op_element(op, env);
             WODEN_INTERFACE_OP_ELEMENT_ADD_STYLE_URI(op, env, uri);
+            AXIS2_URI_FREE(uri, env);
         }
     }
      
@@ -1792,9 +1799,10 @@
     {
         axis2_uri_t *uri = NULL;
         
-        uri = get_uri(reader, env, pat);
+        uri = get_uri(env, pat);
         op = woden_interface_op_to_interface_op_element(op, env);
         WODEN_INTERFACE_OP_ELEMENT_SET_PATTERN(op, env, uri);
+        AXIS2_URI_FREE(uri, env);
     }
     op = woden_interface_op_to_attr_extensible(op, env);
     status = parse_ext_attributes(reader, env, op_el_node, "interface_op_element", 
@@ -2284,9 +2292,10 @@
     {
         axis2_uri_t *uri = NULL;
 
-        uri = get_uri(reader, env, type);
+        uri = get_uri(env, type);
         binding = woden_binding_to_binding_element(binding, env);
         WODEN_BINDING_ELEMENT_SET_TYPE(binding, env, uri);
+        AXIS2_URI_FREE(uri, env);
     }
     
     /* TODO extends attribute */
@@ -3166,7 +3175,6 @@
     axis2_qname_t *binding_qn = NULL;
     axis2_qname_t *attr_binding = NULL;
     axis2_qname_t *attr_address = NULL;
-    axis2_uri_t *address_uri = NULL;
     axiom_element_t *endpoint_el = NULL;
     axiom_element_t *temp_el = NULL;
     axiom_node_t *temp_el_node = NULL;
@@ -3234,9 +3242,12 @@
    
     if(NULL != address)
     {
-        address_uri = get_uri(reader, env, address);
+        axis2_uri_t *address_uri = NULL;
+
+        address_uri = get_uri(env, address);
         endpoint = woden_wsdl10_endpoint_to_endpoint_element(endpoint, env);
         WODEN_WSDL10_ENDPOINT_ELEMENT_SET_ADDRESS(endpoint, env, address_uri);
+        AXIS2_URI_FREE(address_uri, env);
     }
     
     endpoint = woden_wsdl10_endpoint_to_attr_extensible(endpoint, env); 
@@ -3341,9 +3352,10 @@
    
     if(NULL != ref)
     {
-        axis2_uri_t *ref_uri = get_uri(reader, env, ref);
+        axis2_uri_t *ref_uri = get_uri(env, ref);
         feature = woden_feature_to_feature_element(feature, env);
         WODEN_FEATURE_ELEMENT_SET_REF(feature, env, ref_uri);
+        AXIS2_URI_FREE(ref_uri, env);
     }
  
     attr_req = axis2_qname_create_from_string(env, WODEN_WSDL10_ATTR_REQUIRED);
@@ -3468,9 +3480,10 @@
    
     if(NULL != ref)
     {
-        axis2_uri_t *ref_uri = get_uri(reader, env, ref);
+        axis2_uri_t *ref_uri = get_uri(env, ref);
         property = woden_property_to_property_element(property, env);
         WODEN_PROPERTY_ELEMENT_SET_REF(property, env, ref_uri);
+        AXIS2_URI_FREE(ref_uri, env);
     }
  
     property = woden_property_to_attr_extensible(property, env); 
@@ -3701,7 +3714,8 @@
     el = AXIOM_NODE_GET_DATA_ELEMENT(el_node, env);
     namespc = AXIOM_ELEMENT_GET_NAMESPACE(el, env, el_node);
     namespc_uri_str = AXIOM_NAMESPACE_GET_URI(namespc, env);
-    if(NULL == namespc_uri_str || (0 == AXIS2_STRCMP(namespc_uri_str, WODEN_WSDL10_NS_URI_WSDL20)))
+    if(NULL == namespc_uri_str || (0 == AXIS2_STRCMP(namespc_uri_str, 
+                    WODEN_WSDL10_NS_URI_WSDL20)))
     {
         /* TODO Set error message */
         return NULL;
@@ -3835,23 +3849,12 @@
  */
 static axis2_uri_t *
 get_uri(
-        void *reader,
         const axis2_env_t *env,
         const axis2_char_t *uri_str)
 {
-    woden_wsdl10_reader_impl_t *reader_impl = NULL;
-
     AXIS2_ENV_CHECK(env, NULL);
     AXIS2_PARAM_CHECK(env->error, uri_str, NULL);
-    reader_impl = INTF_TO_IMPL(reader);
 
-    if(reader_impl->f_uri)
-    {
-        AXIS2_URI_FREE(reader_impl->f_uri, env);
-        reader_impl->f_uri = NULL;
-    }
-    reader_impl->f_uri = axis2_uri_parse_string(env, uri_str);
-    
-    return reader_impl->f_uri;
+    return axis2_uri_parse_string(env, uri_str);
 }
 

Modified: webservices/axis2/trunk/c/woden/src/wsdl10/desc.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/woden/src/wsdl10/desc.c?rev=428221&r1=428220&r2=428221&view=diff
==============================================================================
--- webservices/axis2/trunk/c/woden/src/wsdl10/desc.c (original)
+++ webservices/axis2/trunk/c/woden/src/wsdl10/desc.c Wed Aug  2 20:59:36 2006
@@ -1045,8 +1045,40 @@
         AXIS2_URI_FREE(desc_impl->f_doc_base_uri, env);
         desc_impl->f_doc_base_uri = NULL;
     }
+    if(desc_impl->f_import_elements)
+    {
+        int i = 0, size = 0;
+
+        size = AXIS2_ARRAY_LIST_SIZE(desc_impl->f_import_elements, env);
+        for(i = 0; i < size; i++)
+        {
+            woden_import_t *import = NULL;
+            
+            import = (woden_import_t *) AXIS2_ARRAY_LIST_GET(desc_impl->
+                    f_import_elements, env, i);
+            WODEN_IMPORT_FREE(import, env);
+        }
+        AXIS2_ARRAY_LIST_FREE(desc_impl->f_import_elements, env);
+        desc_impl->f_import_elements = NULL;
+    }
     /* TODO free f_namespcs */
-    
+    if(desc_impl->f_namespcs)
+    {
+        axis2_hash_index_t *i = NULL;
+        axis2_uri_t *namespc = NULL;
+        void *v = NULL;
+
+        for (i = axis2_hash_first (desc_impl->f_namespcs, env); i; i = 
+                axis2_hash_next (env, i))
+        {
+            axis2_hash_this (i, NULL, NULL, &v);
+            namespc = (axis2_uri_t *) v;
+            AXIS2_URI_FREE(namespc, env);
+        }
+        axis2_hash_free(desc_impl->f_namespcs, env);
+        desc_impl->f_namespcs = NULL;
+    }
+   
     if(desc_impl->super)
     {
         axis2_hash_free(desc_impl->super, env);



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


Mime
View raw message