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 da...@apache.org on 2005/12/12 04:14:32 UTC

svn commit: r356124 [2/3] - in /webservices/axis2/trunk/c/modules: core/description/src/ core/phaseresolver/src/ wsdl/src/

Modified: webservices/axis2/trunk/c/modules/core/phaseresolver/src/phase_resolver.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/phaseresolver/src/phase_resolver.c?rev=356124&r1=356123&r2=356124&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/phaseresolver/src/phase_resolver.c (original)
+++ webservices/axis2/trunk/c/modules/core/phaseresolver/src/phase_resolver.c Sun Dec 11 19:13:55 2005
@@ -132,25 +132,32 @@
 axis2_phase_resolver_create (axis2_env_t **env)
 {
     axis2_phase_resolver_impl_t *phase_resolver_impl = NULL;
-    phase_resolver_impl->phase_resolver.ops = NULL;
-    phase_resolver_impl->axis2_config = NULL;
-    phase_resolver_impl->svc = NULL;
-    phase_resolver_impl->phase_holder = NULL;
+    
 	AXIS2_ENV_CHECK(env, NULL);
 	
 	phase_resolver_impl = (axis2_phase_resolver_impl_t *) AXIS2_MALLOC((*env)->allocator,
 			sizeof(axis2_phase_resolver_impl_t));
-	
-	if(NULL == phase_resolver_impl)
+    
+    if(NULL == phase_resolver_impl)
+    {
         AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL); 
+        return NULL;
+    }
+	
+    phase_resolver_impl->phase_resolver.ops = NULL;
+    phase_resolver_impl->axis2_config = NULL;
+    phase_resolver_impl->svc = NULL;
+    phase_resolver_impl->phase_holder = NULL;
+    
+	
     
 	phase_resolver_impl->phase_resolver.ops = 
 		AXIS2_MALLOC ((*env)->allocator, sizeof(axis2_phase_resolver_ops_t));
 	if(NULL == phase_resolver_impl->phase_resolver.ops)
     {
-        axis2_phase_resolver_free(&(phase_resolver_impl->
-            phase_resolver), env);
+        axis2_phase_resolver_free(&(phase_resolver_impl->phase_resolver), env);
 		AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
+        return NULL;
     }
     
     phase_resolver_impl->phase_resolver.ops->free =  
@@ -186,13 +193,15 @@
                                          struct axis2_engine_config *axis2_config)
 {
     axis2_phase_resolver_impl_t *phase_resolver_impl = NULL;
+    
     AXIS2_ENV_CHECK(env, NULL);
     AXIS2_PARAM_CHECK((*env)->error, axis2_config, NULL);
     
     phase_resolver_impl = (axis2_phase_resolver_impl_t *)
         axis2_phase_resolver_create(env);
-    AXIS2_ENGINE_CONFIG_FREE(phase_resolver_impl->axis2_config, env);
+    
     phase_resolver_impl->axis2_config = axis2_config;
+    
     return &(phase_resolver_impl->phase_resolver);
 }
 
@@ -202,24 +211,19 @@
                                                 struct axis2_svc *svc)
 {
     axis2_phase_resolver_impl_t *phase_resolver_impl = NULL;
+    
     AXIS2_ENV_CHECK(env, NULL);
     AXIS2_PARAM_CHECK((*env)->error, axis2_config, NULL);
     
     phase_resolver_impl = (axis2_phase_resolver_impl_t *)
         axis2_phase_resolver_create(env);
     
-    if(phase_resolver_impl->axis2_config)
+    if(!phase_resolver_impl)
     {
-        AXIS2_ENGINE_CONFIG_FREE(phase_resolver_impl->axis2_config, env);
-        phase_resolver_impl->axis2_config = NULL;
-    }    
+        return NULL;
+    }
     phase_resolver_impl->axis2_config = axis2_config;
     
-    if(phase_resolver_impl->svc)
-    {
-        AXIS2_SVC_FREE(phase_resolver_impl->svc, env);
-        phase_resolver_impl->svc = NULL;
-    }
     phase_resolver_impl->svc = svc;
     
     return &(phase_resolver_impl->phase_resolver);
@@ -231,25 +235,21 @@
 axis2_phase_resolver_free (axis2_phase_resolver_t *phase_resolver, 
                             axis2_env_t **env)
 {
-    axis2_phase_resolver_impl_t *phase_resolver_impl = 
-        AXIS2_INTF_TO_IMPL(phase_resolver);
+    axis2_phase_resolver_impl_t *phase_resolver_impl = NULL;
     
     AXIS2_FUNC_PARAM_CHECK(phase_resolver, env, AXIS2_FAILURE);
     
-	if(NULL != phase_resolver->ops)
-        AXIS2_FREE((*env)->allocator, phase_resolver->ops);
+    phase_resolver_impl = AXIS2_INTF_TO_IMPL(phase_resolver);
     
-    if(NULL != phase_resolver_impl->axis2_config)
+	if(NULL != phase_resolver->ops)
     {
-        AXIS2_ENGINE_CONFIG_FREE(phase_resolver_impl->axis2_config, env);
-        phase_resolver_impl->axis2_config = NULL;
+        AXIS2_FREE((*env)->allocator, phase_resolver->ops);
+        phase_resolver->ops = NULL;
     }
     
-    if(NULL != phase_resolver_impl->svc)
-    {
-        AXIS2_SVC_FREE(phase_resolver_impl->svc, env);
-        phase_resolver_impl->svc = NULL;
-    }
+    phase_resolver_impl->axis2_config = NULL;
+    
+    phase_resolver_impl->svc = NULL;
     
     if(NULL != phase_resolver_impl->phase_holder)
     {
@@ -257,7 +257,11 @@
         phase_resolver_impl->phase_holder = NULL;
     }
     
-    AXIS2_FREE((*env)->allocator, phase_resolver_impl);
+    if(phase_resolver_impl)
+    {
+        AXIS2_FREE((*env)->allocator, phase_resolver_impl);
+        phase_resolver_impl = NULL;
+    }
     
 	return AXIS2_SUCCESS;
 }
@@ -268,17 +272,19 @@
 {
     axis2_phase_resolver_impl_t *resolver_impl = NULL;
     axis2_hash_index_t *index_i = 0;
-    int j = 0;
     axis2_status_t status = AXIS2_FAILURE;
-    void * v = NULL;
     struct axis2_operation *operation = NULL;
     axis2_hash_t *operations = NULL;
     
     resolver_impl = AXIS2_INTF_TO_IMPL(phase_resolver);
+    
     operations = AXIS2_SVC_GET_OPERATIONS(resolver_impl->svc, env);
     
-    for (index_i = axis2_hash_first (operations, env); index_i; index_i = axis2_hash_next (env, index_i))
+    for (index_i = axis2_hash_first (operations, env); index_i; index_i = 
+            axis2_hash_next (env, index_i))
     {
+        void * v = NULL;
+        int j = 0;
         axis2_hash_this (index_i, NULL, NULL, &v);
         operation = (struct axis2_operation *)v;
         for(j = 1; j < 5; j++)
@@ -317,27 +323,30 @@
 {
     axis2_phase_resolver_impl_t *resolver_impl = NULL;
     axis2_array_list_t *all_handlers = NULL;
-    struct axis2_module_desc *module_desc = NULL;
-    struct axis2_flow *flow = NULL;
     axis2_array_list_t *moduleqnames = NULL;
     int i = 0;
-    int j = 0;
+    int size = 0;
     int status = AXIS2_FAILURE;
-    axis2_qname_t *modulename = NULL;
-    struct axis2_handler_desc *metadata = NULL;
-    axis2_char_t *phase_name = NULL;
-    struct axis2_phase_rule *phase_rule = NULL;
+    struct axis2_flow *flow = NULL;    
         
-    all_handlers = axis2_array_list_create(env, 0);
-    
     /**************************************************************************/
     /********************* Handlers from   axis2.xml from modules *************/
     /**************************************************************************/
     
     moduleqnames = (axis2_array_list_t *) AXIS2_ENGINE_CONFIG_GET_ENGAGED_MODULES(
         resolver_impl->axis2_config, env);
-    for (i = 0; i < AXIS2_ARRAY_LIST_SIZE(moduleqnames, env); i++) 
+    
+    size = AXIS2_ARRAY_LIST_SIZE(moduleqnames, env);
+    if(AXIS2_TRUE != AXIS2_ERROR_GET_STATUS_CODE((*env)->error))
     {
+        return AXIS2_FAILURE;
+    }
+    
+    for (i = 0; i < size; i++) 
+    {
+        axis2_qname_t *modulename = NULL;
+        struct axis2_module_desc *module_desc = NULL;
+            
         modulename = (axis2_qname_t *) AXIS2_ARRAY_LIST_GET(moduleqnames, env, i);
         module_desc = AXIS2_ENGINE_CONFIG_GET_MODULE(resolver_impl->axis2_config, env, 
             modulename);
@@ -369,22 +378,16 @@
             status = AXIS2_SVC_ADD_TO_ENGAGED_MODULE_LIST(resolver_impl->svc, env, module_desc);
             if(AXIS2_FAILURE == status) 
             {
-                if(all_handlers)            
-                    AXIS2_ARRAY_LIST_FREE(all_handlers, env); 
                 return status;
             }
             status = AXIS2_OPERATION_ADD_TO_ENGAGE_MODULE_LIST(operation, env, module_desc);
             if(AXIS2_FAILURE == status) 
             {
-                if(all_handlers)            
-                    AXIS2_ARRAY_LIST_FREE(all_handlers, env); 
                 return status;
             }
             
         } else 
         {
-            if(all_handlers)            
-                    AXIS2_ARRAY_LIST_FREE(all_handlers, env);
                 
             AXIS2_ERROR_SET((*env)->error, INVALID_MODULE_REF, AXIS2_FAILURE);
             return AXIS2_FAILURE;
@@ -392,21 +395,51 @@
 
         if (NULL != flow) 
         {
-            for (j = 0; j < AXIS2_FLOW_GET_HANDLER_COUNT(flow, env); j++) 
+            int j = 0;
+            int count = 0;
+            count = AXIS2_FLOW_GET_HANDLER_COUNT(flow, env);
+            if(AXIS2_TRUE != AXIS2_ERROR_GET_STATUS_CODE((*env)->error))
+            {
+                return AXIS2_FAILURE;
+            }
+           
+            all_handlers = axis2_array_list_create(env, 0);
+            if(!all_handlers)
+            {
+                return AXIS2_FAILURE;
+            }
+
+            for (j = 0; j < count; j++) 
             {
+                struct axis2_handler_desc *metadata = NULL;
+                axis2_char_t *phase_name = NULL;
+                struct axis2_phase_rule *phase_rule = NULL;
+                    
                 metadata = AXIS2_FLOW_GET_HANDLER(flow, env, j);
                 phase_rule = AXIS2_HANDLER_DESC_GET_RULES(metadata, env);
                 phase_name = AXIS2_PHASE_RULE_GET_NAME(phase_rule, env);
+                if(NULL != phase_name)
+                {
+                    if(all_handlers)
+                    {  
+                        AXIS2_ARRAY_LIST_FREE(all_handlers, env);
+                        all_handlers = NULL;                        
+                    }
+                    return AXIS2_FAILURE;
+                }
                 if ((0 != AXIS2_STRCMP(AXIS2_PHASE_TRANSPORTIN, phase_name)) &&
                     (0 != AXIS2_STRCMP(AXIS2_PHASE_DISPATCH, phase_name)) &&
                     (0 != AXIS2_STRCMP(AXIS2_PHASE_POST_DISPATCH, phase_name)) &&
                     (0 != AXIS2_STRCMP(AXIS2_PHASE_PRE_DISPATCH, phase_name)))
-                {
+                { 
                     status = AXIS2_ARRAY_LIST_ADD(all_handlers, env, metadata);
                     if(AXIS2_FAILURE == status)
                     {   
-                        if(all_handlers)            
-                            AXIS2_ARRAY_LIST_FREE(all_handlers, env);                         
+                        if(all_handlers)
+                        {  
+                            AXIS2_ARRAY_LIST_FREE(all_handlers, env);
+                            all_handlers = NULL;                        
+                        }                        
                         return status;
                     }
                 } else 
@@ -427,6 +460,7 @@
     
     switch (type) 
     {
+            
         case AXIS2_INFLOW:
         {
             flow = AXIS2_WSDL_COMPONENT_GET_COMPONENT_PROPERTY(resolver_impl->
@@ -454,10 +488,23 @@
     }
     if (NULL != flow) 
     {
-        for (j = 0; j < AXIS2_FLOW_GET_HANDLER_COUNT(flow, env); j++) 
+        int j = 0;
+        int count = 0;
+        count = AXIS2_FLOW_GET_HANDLER_COUNT(flow, env);
+        if(AXIS2_FAILURE == AXIS2_ERROR_GET_STATUS_CODE((*env)->error))
+        {
+            if(all_handlers)
+            {  
+                AXIS2_ARRAY_LIST_FREE(all_handlers, env);
+                all_handlers = NULL;                        
+            }                        
+            return AXIS2_FAILURE;              
+        }
+        for (j = 0; j < count; j++) 
         {
-            if(metadata)
-                AXIS2_HANDLER_DESC_FREE(metadata, env);
+            struct axis2_handler_desc *metadata = NULL;
+            axis2_char_t *phase_name = NULL;
+                
             metadata = AXIS2_FLOW_GET_HANDLER(flow, env, j);
             phase_name = AXIS2_PHASE_RULE_GET_NAME(AXIS2_HANDLER_DESC_GET_RULES(metadata, 
                 env), env);
@@ -471,8 +518,11 @@
                     (0 != AXIS2_STRCMP(AXIS2_PHASE_POST_DISPATCH, phase_name)) &&
                     (0 != AXIS2_STRCMP(AXIS2_PHASE_PRE_DISPATCH, phase_name)))
             {
-                if(all_handlers)            
-                        AXIS2_ARRAY_LIST_FREE(all_handlers, env);
+                if(all_handlers)
+                {  
+                    AXIS2_ARRAY_LIST_FREE(all_handlers, env);
+                    all_handlers = NULL;                        
+                }
                 AXIS2_ERROR_SET((*env)->error, 
                     SERVICE_MODULE_CAN_NOT_REFER_GLOBAL_PHASE, AXIS2_FAILURE);
                 return AXIS2_FAILURE;
@@ -482,8 +532,11 @@
                 status = AXIS2_ARRAY_LIST_ADD(all_handlers, env, metadata);
                 if(AXIS2_FAILURE == status) 
                 {
-                    if(all_handlers)            
-                        AXIS2_ARRAY_LIST_FREE(all_handlers, env); 
+                    if(all_handlers)
+                    {  
+                        AXIS2_ARRAY_LIST_FREE(all_handlers, env);
+                        all_handlers = NULL;                        
+                    }
                     return status;
                 }
             }
@@ -521,6 +574,8 @@
     }
     for (i = 0; i < AXIS2_ARRAY_LIST_SIZE(all_handlers, env); i++) 
     {
+        struct axis2_handler_desc *metadata = NULL;
+            
         metadata = (struct axis2_handler_desc *)
             AXIS2_ARRAY_LIST_GET(all_handlers, env, i);
         status = AXIS2_PHASE_HOLDER_ADD_HANDLER(resolver_impl->phase_holder, env, metadata);
@@ -555,6 +610,11 @@
     transports_out = AXIS2_ENGINE_CONFIG_GET_TRANSPORTS_OUT(
         resolver_impl->axis2_config, env);
 
+    if(!transports_in || transports_out)
+    {
+        return AXIS2_FAILURE;
+    }
+
     for (index_i = axis2_hash_first (transports_in, env); index_i; index_i = axis2_hash_next (env, index_i))
     {
 
@@ -583,16 +643,16 @@
                                                 axis2_env_t **env,
                                                 struct axis2_transport_in_desc *transport)
 {
-    struct axis2_flow *flow = NULL;
-    struct axis2_phase *phase = NULL;
     int type = 0;
     int j = 0;
     axis2_status_t status = AXIS2_FAILURE;
     axis2_array_list_t *handlers = NULL;
-    struct axis2_handler_desc *metadata = NULL;
-    struct axis2_phase_holder *phase_holder = NULL;
     
-    for (type = 1; type < 4; type++) {
+    for (type = 1; type < 4; type++) 
+    {
+        struct axis2_flow *flow = NULL;
+        struct axis2_phase *phase = NULL;
+
         switch (type) {
             case AXIS2_INFLOW:
             {
@@ -609,9 +669,13 @@
         }
         if (NULL != flow) 
         {
+            struct axis2_phase_holder *phase_holder = NULL;
+
             handlers = axis2_array_list_create(env, 0);
             for (j = 0; j < AXIS2_FLOW_GET_HANDLER_COUNT(flow, env); j++) 
             {
+                struct axis2_handler_desc *metadata = NULL;
+
                 metadata = AXIS2_FLOW_GET_HANDLER(flow, env, j);
                 status = AXIS2_PHASE_RULE_SET_NAME(AXIS2_HANDLER_DESC_GET_RULES(metadata,
                     env), env, AXIS2_TRANSPORT_PHASE);
@@ -657,17 +721,15 @@
                                                 axis2_env_t **env,
                                                 struct axis2_transport_out_desc *transport)
 {
-    struct axis2_flow *flow = NULL;
-    struct axis2_phase *phase = NULL;
     int type = 0;
-    int j = 0;
     axis2_status_t status = AXIS2_FAILURE;
     axis2_array_list_t *handlers = NULL;
-    struct axis2_handler_desc *metadata = NULL;
-    struct axis2_phase_holder *phase_holder = NULL;
         
     for (type = 1; type < 5; type++) 
     {
+        struct axis2_flow *flow = NULL;
+        struct axis2_phase *phase = NULL;
+        
         switch (type) {
             case AXIS2_OUTFLOW:
             {
@@ -685,9 +747,20 @@
         
         if (NULL != flow) 
         {
+            struct axis2_phase_holder *phase_holder = NULL;
+            int hndlr_count = 0;
+            
+            hndlr_count = AXIS2_FLOW_GET_HANDLER_COUNT(flow, env);
+            if(AXIS2_TRUE != AXIS2_ERROR_GET_STATUS_CODE((*env)->error))
+            {
+                return AXIS2_FAILURE;
+            }
             handlers = axis2_array_list_create(env, 0);
-            for (j = 0; j < AXIS2_FLOW_GET_HANDLER_COUNT(flow, env); j++) 
+            int j = 0;
+            for (j = 0; j < hndlr_count; j++) 
             {
+                struct axis2_handler_desc *metadata = NULL;
+                
                 metadata = AXIS2_FLOW_GET_HANDLER(flow, env, j);
                 status = AXIS2_PHASE_RULE_SET_NAME(AXIS2_HANDLER_DESC_GET_RULES(metadata,
                     env), env, AXIS2_TRANSPORT_PHASE);
@@ -722,6 +795,7 @@
                 AXIS2_PHASE_HOLDER_FREE(phase_holder, env);
         } else 
         {
+            /* Do nothing */
         }
     }
     if(handlers)
@@ -738,12 +812,6 @@
     axis2_phase_resolver_impl_t *resolver_impl = NULL;
     axis2_hash_t *svc_grps = NULL;
     axis2_hash_index_t *index_i = NULL;
-    axis2_hash_index_t *index_j = NULL;
-    void *v = NULL;
-    void *w = NULL;
-    struct axis2_svc_grp *svc_grp = NULL;
-    axis2_hash_t *svcs = NULL;
-    struct axis2_svc *svc = NULL;
     axis2_status_t status = AXIS2_FAILURE;
         
     resolver_impl = AXIS2_INTF_TO_IMPL(phase_resolver);
@@ -752,16 +820,29 @@
     if(AXIS2_FAILURE == status)
         return status;
     svc_grps = AXIS2_ENGINE_CONFIG_GET_SVC_GRPS(resolver_impl->axis2_config, env);
+    if(!svc_grps)
+    {
+        return AXIS2_FAILURE;
+    }
     index_i = axis2_hash_first (svc_grps, env);
-    do 
+    while(NULL != index_i)
     {
+        axis2_hash_t *svcs = NULL;
+        struct axis2_svc_grp *svc_grp = NULL;
+        void *v = NULL;
+        axis2_hash_index_t *index_j = NULL;
+        axis2_qname_t *mod_name = NULL; 
+
         axis2_hash_this (index_i, NULL, NULL, &v);
         svc_grp = (struct axis2_svc_grp *) v;
         svcs = AXIS2_SVC_GRP_GET_SVCS(svc_grp, env);    
         
         index_j = axis2_hash_first (svcs, env);
-        do
+        while(NULL != index_j)
         {
+            struct axis2_svc *svc = NULL;
+            void *w = NULL;
+
             axis2_hash_this (index_i, NULL, NULL, &w);
             svc = (struct axis2_svc *) w;
                 
@@ -786,9 +867,8 @@
             }
             index_j = axis2_hash_next (env, index_j);
             
-        } while(NULL != index_j);
-        
-        axis2_qname_t *mod_name = AXIS2_MODULE_DESC_GET_NAME(module, env);
+        }         
+        mod_name = AXIS2_MODULE_DESC_GET_NAME(module, env);
         status = AXIS2_SVC_GRP_ADD_MODULE(svc_grp, env, 
             mod_name);
         
@@ -798,8 +878,7 @@
         }
         index_i = axis2_hash_next (env, index_i);
            
-    } while(NULL != index_i);
-    
+    }     
     return status;
 }
 
@@ -812,16 +891,8 @@
     axis2_phase_resolver_impl_t *resolver_impl = NULL;
     axis2_hash_t *operations = NULL;
     axis2_bool_t engaged = AXIS2_FALSE;
-    struct axis2_operation *op_desc = NULL;
-    struct axis2_module_desc *module_desc_l = NULL;
-    struct axis2_handler_desc *metadata = NULL;    
     axis2_hash_index_t *index_i = NULL;
-    void *v = NULL;
-    axis2_array_list_t *modules = NULL;
-    int j = 0;
     int type = 0;
-    struct axis2_flow *flow = NULL;
-    axis2_char_t *phase_name = NULL;
     axis2_status_t status = AXIS2_FAILURE;
     
     resolver_impl = AXIS2_INTF_TO_IMPL(phase_resolver);
@@ -829,12 +900,19 @@
     operations = AXIS2_SVC_GET_OPERATIONS(svc, env);
     for (index_i = axis2_hash_first (operations, env); index_i; index_i = axis2_hash_next (env, index_i))
     {
+        void *v = NULL;
+        struct axis2_operation *op_desc = NULL;
+        axis2_array_list_t *modules = NULL;
+        struct axis2_flow *flow = NULL;
 
         axis2_hash_this (index_i, NULL, NULL, &v);
         op_desc = (struct axis2_operation *) v;
         modules = AXIS2_OPERATION_GET_MODULES(op_desc, env);
+        int j = 0;
         for(j = 0; j < AXIS2_ARRAY_LIST_SIZE(modules, env); j++)
         {
+            struct axis2_module_desc *module_desc_l = NULL;
+
             module_desc_l = (struct axis2_module_desc *) 
                 AXIS2_ARRAY_LIST_GET(modules, env, j);
             if(AXIS2_QNAME_EQUALS(AXIS2_MODULE_DESC_GET_NAME(module_desc_l, env),
@@ -906,6 +984,9 @@
             {
                 for (j = 0; j < AXIS2_FLOW_GET_HANDLER_COUNT(flow, env); j++) 
                 {
+                    struct axis2_handler_desc *metadata = NULL;    
+                    axis2_char_t *phase_name = NULL;
+
                     metadata = AXIS2_FLOW_GET_HANDLER(flow, env, j);
                     phase_name = AXIS2_PHASE_RULE_GET_NAME(
                         AXIS2_HANDLER_DESC_GET_RULES(metadata, env), env);
@@ -937,17 +1018,15 @@
                                                 struct axis2_module_desc *module_desc)
 {
     axis2_phase_resolver_impl_t *resolver_impl = NULL;
-    struct axis2_flow *flow = NULL;
     int type = 0;
-    int j = 0;
-    struct axis2_handler_desc *metadata = NULL;
-    axis2_char_t *phase_name = NULL;
     axis2_status_t status = AXIS2_FAILURE;
     
     resolver_impl = AXIS2_INTF_TO_IMPL(phase_resolver);
     
     for (type = 1; type < 5; type++) 
     {
+        struct axis2_flow *flow = NULL;
+
         switch (type) 
         {
             case AXIS2_INFLOW:
@@ -1007,8 +1086,12 @@
         }
         if (NULL != flow) 
         {
+            int j = 0;
             for (j = 0; j < AXIS2_FLOW_GET_HANDLER_COUNT(flow, env); j++) 
             {
+                struct axis2_handler_desc *metadata = NULL;
+                axis2_char_t *phase_name = NULL;
+
                 metadata = AXIS2_FLOW_GET_HANDLER(flow, env, j);
                 phase_name = AXIS2_PHASE_RULE_GET_NAME(
                         AXIS2_HANDLER_DESC_GET_RULES(metadata, env), env);
@@ -1046,9 +1129,6 @@
     axis2_phase_resolver_impl_t *resolver_impl = NULL;
     axis2_hash_t *operations = NULL;
     axis2_bool_t engaged = AXIS2_FALSE;
-    struct axis2_operation *op_desc = NULL;
-    axis2_array_list_t *modules = NULL;
-    struct axis2_module_desc *module_desc_l = NULL;
     axis2_hash_index_t *index_i = NULL;
     void *v = NULL;
     int j = 0;
@@ -1057,16 +1137,30 @@
     resolver_impl = AXIS2_INTF_TO_IMPL(phase_resolver);
     
     operations = AXIS2_SVC_GET_OPERATIONS(resolver_impl->svc, env);
-    AXIS2_SVC_ADD_MODULE_OPERATIONS(resolver_impl->svc, env, module_desc, 
-        resolver_impl->axis2_config);
-    for (index_i = axis2_hash_first (operations, env); index_i; index_i = axis2_hash_next (env, index_i))
+    if(!operations)
     {
+        return AXIS2_FAILURE;
+    }
+    status = AXIS2_SVC_ADD_MODULE_OPERATIONS(resolver_impl->svc, env, module_desc, 
+            resolver_impl->axis2_config);
+
+    if(AXIS2_FAILURE == status)
+    {
+        return AXIS2_FAILURE;
+    }
+    for (index_i = axis2_hash_first (operations, env); index_i; index_i = 
+            axis2_hash_next (env, index_i))
+    {
+        axis2_array_list_t *modules = NULL;
+        struct axis2_operation *op_desc = NULL;
 
         axis2_hash_this (index_i, NULL, NULL, &v);
         op_desc = (struct axis2_operation *) v;
         modules = AXIS2_OPERATION_GET_MODULES(op_desc, env);
         for(j = 0; j < AXIS2_ARRAY_LIST_SIZE(modules, env); j++)
         {
+            struct axis2_module_desc *module_desc_l = NULL;
+
             module_desc_l = AXIS2_ARRAY_LIST_GET(modules, env, j);
             if(0 == AXIS2_QNAME_EQUALS(AXIS2_MODULE_DESC_GET_NAME(module_desc, env),
                     env, AXIS2_MODULE_DESC_GET_NAME(module_desc_l, env)))
@@ -1076,12 +1170,13 @@
             }
             if(AXIS2_FALSE == engaged)
             {
-                status = axis2_phase_resolver_engage_module_to_operation(phase_resolver, 
-                    env, op_desc, module_desc);
+                status = axis2_phase_resolver_engage_module_to_operation(
+                    phase_resolver, env, op_desc, module_desc);
                 if(AXIS2_FAILURE == status)
                     return status;
                 
-                status = AXIS2_OPERATION_ADD_TO_ENGAGE_MODULE_LIST(op_desc, env, module_desc);
+                status = AXIS2_OPERATION_ADD_TO_ENGAGE_MODULE_LIST(op_desc, env, 
+                    module_desc);
             }
         }
 
@@ -1097,17 +1192,16 @@
                                                 struct axis2_module_desc *module_desc)
 {
     axis2_phase_resolver_impl_t *resolver_impl = NULL;
-    struct axis2_flow *flow = NULL;
     int type = 0;
     int j = 0;
-    struct axis2_handler_desc *metadata = NULL;
     axis2_status_t status = AXIS2_FALSE;
-    axis2_char_t *phase_name = NULL;
     
     resolver_impl = AXIS2_INTF_TO_IMPL(phase_resolver);
     
     for (type = 1; type < 5; type++) 
     {
+        struct axis2_flow *flow = NULL;
+
         switch (type) {
             case AXIS2_INFLOW:
             {
@@ -1160,6 +1254,9 @@
         if (NULL != flow) {
             for (j = 0; j < AXIS2_FLOW_GET_HANDLER_COUNT(flow, env); j++) 
             {
+                struct axis2_handler_desc *metadata = NULL;
+                axis2_char_t *phase_name = NULL;
+
                 metadata = AXIS2_FLOW_GET_HANDLER(flow, env, j);
                 phase_name = AXIS2_PHASE_RULE_GET_NAME(
                         AXIS2_HANDLER_DESC_GET_RULES(metadata, env), env);

Modified: webservices/axis2/trunk/c/modules/wsdl/src/axis2_wsdl.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/wsdl/src/axis2_wsdl.h?rev=356124&r1=356123&r2=356124&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/wsdl/src/axis2_wsdl.h (original)
+++ webservices/axis2/trunk/c/modules/wsdl/src/axis2_wsdl.h Sun Dec 11 19:13:55 2005
@@ -28,7 +28,7 @@
 extern "C" 
 {
 #endif
-
+    
 /*********************************** Constansts********************************/
 /**
  * Field WSDL2_0_NAMESPACE

Modified: webservices/axis2/trunk/c/modules/wsdl/src/wsdl_binding.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/wsdl/src/wsdl_binding.c?rev=356124&r1=356123&r2=356124&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/wsdl/src/wsdl_binding.c (original)
+++ webservices/axis2/trunk/c/modules/wsdl/src/wsdl_binding.c Sun Dec 11 19:13:55 2005
@@ -109,7 +109,7 @@
 axis2_status_t AXIS2_CALL
 axis2_wsdl_binding_add_binding_fault(axis2_wsdl_binding_t *wsdl_binding,
                                         axis2_env_t **env,
-                                        axis2_wsdl_binding_fault_t *binding_fault);
+                                        struct axis2_wsdl_binding_fault *binding_fault);
 
 axis2_wsdl_binding_fault_t * AXIS2_CALL
 axis2_wsdl_binding_get_binding_fault(axis2_wsdl_binding_t *wsdl_binding,
@@ -121,50 +121,55 @@
 axis2_wsdl_binding_t * AXIS2_CALL 
 axis2_wsdl_binding_create (axis2_env_t **env)
 {
+    axis2_wsdl_binding_impl_t *wsdl_binding_impl = NULL;
 	AXIS2_ENV_CHECK(env, NULL);
 	
-	axis2_wsdl_binding_impl_t *wsdl_binding_impl = 
-		(axis2_wsdl_binding_impl_t *) AXIS2_MALLOC((*env)->allocator,
+	wsdl_binding_impl = (axis2_wsdl_binding_impl_t *) AXIS2_MALLOC((*env)->allocator,
 			sizeof(axis2_wsdl_binding_impl_t));
 	
-	
 	if(NULL == wsdl_binding_impl)
+    {
         AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL); 
-	
+        return NULL;
+    }
+    
+    wsdl_binding_impl->qname = NULL;
+	wsdl_binding_impl->binding_operations = NULL;
+    wsdl_binding_impl->binding_faults = NULL;
+    wsdl_binding_impl->wsdl_binding.extensible_component = NULL;
+    wsdl_binding_impl->wsdl_binding.ops = NULL;
     
     wsdl_binding_impl->binding_operations = axis2_hash_make(env);
     if(NULL == wsdl_binding_impl->binding_operations)
     {
-        AXIS2_FREE((*env)->allocator, wsdl_binding_impl);
+        axis2_wsdl_binding_free(&(wsdl_binding_impl->wsdl_binding), env);
         AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
+        return NULL;
     }
     
     wsdl_binding_impl->binding_faults = axis2_hash_make(env);
     if(NULL == wsdl_binding_impl->binding_faults)
     {
-        axis2_hash_free(wsdl_binding_impl->binding_operations, env);
-        AXIS2_FREE((*env)->allocator, wsdl_binding_impl);
+        axis2_wsdl_binding_free(&(wsdl_binding_impl->wsdl_binding), env);
         AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
+        return NULL;
     }
     
     wsdl_binding_impl->wsdl_binding.extensible_component = axis2_wsdl_extensible_component_create(env);
     if(NULL == wsdl_binding_impl->wsdl_binding.extensible_component)
     {
-        axis2_hash_free(wsdl_binding_impl->binding_operations, env);
-        axis2_hash_free(wsdl_binding_impl->binding_faults, env);
-        AXIS2_FREE((*env)->allocator, wsdl_binding_impl);
+        axis2_wsdl_binding_free(&(wsdl_binding_impl->wsdl_binding), env);
         AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
+        return NULL;
     }
     
 	wsdl_binding_impl->wsdl_binding.ops = 
 		AXIS2_MALLOC ((*env)->allocator, sizeof(axis2_wsdl_binding_ops_t));
 	if(NULL == wsdl_binding_impl->wsdl_binding.ops)
     {
-        AXIS2_WSDL_EXTENSIBLE_COMPONENT_FREE(wsdl_binding_impl->wsdl_binding.extensible_component, env);
-        axis2_hash_free(wsdl_binding_impl->binding_operations,env);
-        axis2_hash_free(wsdl_binding_impl->binding_faults, env);
-        AXIS2_FREE((*env)->allocator, wsdl_binding_impl);
+        axis2_wsdl_binding_free(&(wsdl_binding_impl->wsdl_binding), env);
 		AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
+        return NULL;
     }
     
 	wsdl_binding_impl->wsdl_binding.ops->free =  axis2_wsdl_binding_free;
@@ -206,9 +211,7 @@
         axis2_wsdl_binding_add_binding_fault;
         
     wsdl_binding_impl->wsdl_binding.ops->get_binding_fault = 
-        axis2_wsdl_binding_get_binding_fault;        
-        
-	wsdl_binding_impl->qname = NULL;
+        axis2_wsdl_binding_get_binding_fault;       
 	
 	return &(wsdl_binding_impl->wsdl_binding);
 }
@@ -219,30 +222,84 @@
 axis2_wsdl_binding_free (axis2_wsdl_binding_t *wsdl_binding, 
                             axis2_env_t **env)
 {
+    axis2_wsdl_binding_impl_t *binding_impl = NULL;
+    
     AXIS2_FUNC_PARAM_CHECK(wsdl_binding, env, AXIS2_FAILURE);
+    
+    binding_impl = AXIS2_INTF_TO_IMPL(wsdl_binding);
+    
 	if(NULL != wsdl_binding->ops)
+    {
         AXIS2_FREE((*env)->allocator, wsdl_binding->ops);
+        wsdl_binding->ops = NULL;
+    }
     
-    if(NULL != AXIS2_INTF_TO_IMPL(wsdl_binding)->qname)
+    if(NULL != binding_impl->qname)
     {
         AXIS2_QNAME_FREE(AXIS2_INTF_TO_IMPL(wsdl_binding)->qname, env);
+        binding_impl->qname = NULL;
     }
     
-    if(NULL != AXIS2_INTF_TO_IMPL(wsdl_binding)->bound_interface)
-        AXIS2_WSDL_INTERFACE_FREE(AXIS2_INTF_TO_IMPL(wsdl_binding)->
-            bound_interface, env);
+    if(NULL != binding_impl->bound_interface)
+    {
+        AXIS2_WSDL_INTERFACE_FREE(binding_impl->bound_interface, env);
+        binding_impl->bound_interface = NULL;
+    }
     
-    if(NULL != AXIS2_INTF_TO_IMPL(wsdl_binding)->binding_faults)
-        axis2_hash_free(AXIS2_INTF_TO_IMPL(wsdl_binding)->binding_faults, env);
+    if(NULL != binding_impl->binding_faults)
+    {
+        axis2_hash_index_t *hi = NULL;
+        void *val = NULL;
+        for (hi = axis2_hash_first (binding_impl->binding_faults, env); hi;
+                 hi = axis2_hash_next ( env, hi))
+        {
+            struct axis2_wsdl_binding_fault *fault = NULL;
+            axis2_hash_this (hi, NULL, NULL, &val);
+            fault = (struct axis2_wsdl_binding_fault *) val;
+            if (fault)
+                AXIS2_WSDL_BINDING_FAULT_FREE (fault, env);
+            
+            val = NULL;
+            fault = NULL;
+               
+        }
+        axis2_hash_free(binding_impl->binding_faults, env);
+        binding_impl->binding_faults = NULL;
+    }
     
-    if(NULL != AXIS2_INTF_TO_IMPL(wsdl_binding)->binding_operations)
-        axis2_hash_free(AXIS2_INTF_TO_IMPL(wsdl_binding)->binding_operations, env);
+    if(NULL != binding_impl->binding_operations)
+    {
+        axis2_hash_index_t *hi = NULL;
+        void *val = NULL;
+        for (hi = axis2_hash_first (binding_impl->binding_operations, env); hi;
+                 hi = axis2_hash_next ( env, hi))
+        {
+            struct axis2_wsdl_binding_operation *binding_optr = NULL;
+            axis2_hash_this (hi, NULL, NULL, &val);
+            binding_optr = (struct axis2_wsdl_binding_operation *) val;
+            if (binding_optr)
+            {
+                AXIS2_WSDL_BINDING_OPERATION_FREE (binding_optr, env);
+            }
+            
+            val = NULL;
+            binding_optr = NULL;
+               
+        }
+        axis2_hash_free(binding_impl->binding_operations, env);
+        binding_impl->binding_operations = NULL;
+    }
     
     if(NULL != wsdl_binding->extensible_component)
+    {
         AXIS2_WSDL_EXTENSIBLE_COMPONENT_FREE(wsdl_binding->
             extensible_component, env);
+        wsdl_binding->extensible_component = NULL;
+    }
     
-    AXIS2_FREE((*env)->allocator, AXIS2_INTF_TO_IMPL(wsdl_binding));
+    if(binding_impl)
+        AXIS2_FREE((*env)->allocator, binding_impl);
+    binding_impl = NULL;
     
 	return AXIS2_SUCCESS;
 }
@@ -260,9 +317,19 @@
                                         axis2_env_t **env,
                                         struct axis2_wsdl_interface *bound_interface) 
 { 
+    axis2_wsdl_binding_impl_t *binding_impl = NULL;
+    
     AXIS2_FUNC_PARAM_CHECK(wsdl_binding, env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, bound_interface, AXIS2_FAILURE);
-    AXIS2_INTF_TO_IMPL(wsdl_binding)->bound_interface = bound_interface;
+    
+    binding_impl = AXIS2_INTF_TO_IMPL(wsdl_binding);
+    if(binding_impl->bound_interface)
+    {
+        AXIS2_WSDL_INTERFACE_FREE(binding_impl->bound_interface, env);
+        binding_impl->bound_interface = NULL;
+    }
+        
+    binding_impl->bound_interface = bound_interface;
     return AXIS2_SUCCESS;
 }
 
@@ -279,9 +346,18 @@
                             axis2_env_t **env,
                             axis2_qname_t *qname) 
 {
+    axis2_wsdl_binding_impl_t *binding_impl = NULL;
+    
     AXIS2_FUNC_PARAM_CHECK(wsdl_binding, env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, qname, AXIS2_FAILURE);
-    AXIS2_INTF_TO_IMPL(wsdl_binding)->qname = qname;
+    
+    binding_impl = AXIS2_INTF_TO_IMPL(wsdl_binding);
+    if(binding_impl->qname)
+    {
+        AXIS2_QNAME_FREE(binding_impl->qname, env);
+        binding_impl->qname = NULL;
+    }
+    binding_impl->qname = qname;
     return AXIS2_SUCCESS;
 }
 
@@ -297,7 +373,9 @@
 axis2_wsdl_binding_get_binding_faults(axis2_wsdl_binding_t *wsdl_binding,
                                         axis2_env_t **env) 
 {
+    
     AXIS2_FUNC_PARAM_CHECK(wsdl_binding, env, NULL);
+    
     return AXIS2_INTF_TO_IMPL(wsdl_binding)->binding_faults;
 }
 
@@ -306,9 +384,34 @@
                                         axis2_env_t **env,
                                         axis2_hash_t *binding_faults) 
 {
+    axis2_wsdl_binding_impl_t *binding_impl = NULL;
+    
     AXIS2_FUNC_PARAM_CHECK(wsdl_binding, env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, binding_faults, AXIS2_FAILURE);
-    AXIS2_INTF_TO_IMPL(wsdl_binding)->binding_faults = binding_faults;
+    
+    binding_impl = AXIS2_INTF_TO_IMPL(wsdl_binding);
+    
+    if(NULL != binding_impl->binding_faults)
+    {
+        axis2_hash_index_t *hi = NULL;
+        void *val = NULL;
+        for (hi = axis2_hash_first (binding_impl->binding_faults, env); hi;
+                 hi = axis2_hash_next ( env, hi))
+        {
+            struct axis2_wsdl_binding_fault *fault = NULL;
+            axis2_hash_this (hi, NULL, NULL, &val);
+            fault = (struct axis2_wsdl_binding_fault *) val;
+            if (fault)
+                AXIS2_WSDL_BINDING_FAULT_FREE (fault, env);
+            
+            val = NULL;
+            fault = NULL;
+               
+        }
+        axis2_hash_free(binding_impl->binding_faults, env);
+        binding_impl->binding_faults = NULL;
+    }
+    binding_impl->binding_faults = binding_faults;
     return AXIS2_SUCCESS;
 }
 
@@ -325,9 +428,35 @@
                                             axis2_env_t **env,
                                             axis2_hash_t *binding_operations) 
 {
+    axis2_wsdl_binding_impl_t *binding_impl = NULL;
+    
     AXIS2_FUNC_PARAM_CHECK(wsdl_binding, env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, binding_operations, AXIS2_FAILURE);
-    AXIS2_INTF_TO_IMPL(wsdl_binding)->binding_operations = binding_operations;
+    
+    binding_impl = AXIS2_INTF_TO_IMPL(wsdl_binding);
+    if(NULL != binding_impl->binding_operations)
+    {
+        axis2_hash_index_t *hi = NULL;
+        void *val = NULL;
+        for (hi = axis2_hash_first (binding_impl->binding_operations, env); hi;
+                 hi = axis2_hash_next ( env, hi))
+        {
+            struct axis2_wsdl_binding_operation *binding_optr = NULL;
+            axis2_hash_this (hi, NULL, NULL, &val);
+            binding_optr = (struct axis2_wsdl_binding_operation *) val;
+            if (binding_optr)
+            {
+                AXIS2_WSDL_BINDING_OPERATION_FREE (binding_optr, env);
+            }
+            
+            val = NULL;
+            binding_optr = NULL;
+               
+        }
+        axis2_hash_free(binding_impl->binding_operations, env);
+        binding_impl->binding_operations = NULL;
+    }
+    binding_impl->binding_operations = binding_operations;
     return AXIS2_SUCCESS;
 }
 
@@ -336,12 +465,21 @@
                                             axis2_env_t **env,
                                             struct axis2_wsdl_binding_operation *binding_operation) 
 {
+    axis2_wsdl_binding_impl_t *binding_impl = NULL;
+    axis2_qname_t *qname = NULL;
+    
     AXIS2_FUNC_PARAM_CHECK(wsdl_binding, env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, binding_operation, AXIS2_FAILURE);
     
-    axis2_hash_set(AXIS2_INTF_TO_IMPL(wsdl_binding)->binding_operations,
-        AXIS2_WSDL_BINDING_OPERATION_GET_QNAME(binding_operation, env),
-            sizeof(axis2_qname_t), binding_operation);
+    binding_impl = AXIS2_INTF_TO_IMPL(wsdl_binding);
+    
+    qname = AXIS2_WSDL_BINDING_OPERATION_GET_QNAME(binding_operation, env);
+    if(NULL == qname)
+    {
+        return AXIS2_FAILURE;
+    }
+    axis2_hash_set(binding_impl->binding_operations, qname, 
+        sizeof(axis2_qname_t), binding_operation);
     
     return AXIS2_SUCCESS;
 }
@@ -360,13 +498,22 @@
 axis2_status_t AXIS2_CALL
 axis2_wsdl_binding_add_binding_fault(axis2_wsdl_binding_t *wsdl_binding,
                                         axis2_env_t **env,
-                                        axis2_wsdl_binding_fault_t *binding_fault) 
+                                        struct axis2_wsdl_binding_fault *binding_fault) 
 {
+    axis2_wsdl_binding_impl_t *binding_impl = NULL;
+    axis2_qname_t *fault_ref = NULL;
+    
     AXIS2_FUNC_PARAM_CHECK(wsdl_binding, env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, binding_fault, AXIS2_FAILURE);
     
-    axis2_hash_set(AXIS2_INTF_TO_IMPL(wsdl_binding)->binding_faults,
-        AXIS2_WSDL_BINDING_FAULT_GET_REF(binding_fault, env), sizeof(axis2_qname_t),
+    binding_impl = AXIS2_INTF_TO_IMPL(wsdl_binding);
+    
+    fault_ref = AXIS2_WSDL_BINDING_FAULT_GET_REF(binding_fault, env);
+    if(!fault_ref)
+    {
+        return AXIS2_FAILURE;
+    }
+    axis2_hash_set(binding_impl->binding_faults, fault_ref, sizeof(axis2_qname_t),
         binding_fault);
     return AXIS2_SUCCESS;
 }

Modified: webservices/axis2/trunk/c/modules/wsdl/src/wsdl_binding_fault.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/wsdl/src/wsdl_binding_fault.c?rev=356124&r1=356123&r2=356124&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/wsdl/src/wsdl_binding_fault.c (original)
+++ webservices/axis2/trunk/c/modules/wsdl/src/wsdl_binding_fault.c Sun Dec 11 19:13:55 2005
@@ -53,31 +53,41 @@
 axis2_wsdl_binding_fault_t * AXIS2_CALL 
 axis2_binding_fault_create (axis2_env_t **env)
 {
+    axis2_wsdl_binding_fault_impl_t *binding_fault_impl = NULL;
+    
 	AXIS2_ENV_CHECK(env, NULL);
 	
-	axis2_wsdl_binding_fault_impl_t *binding_fault_impl = 
-		(axis2_wsdl_binding_fault_impl_t *) AXIS2_MALLOC((*env)->allocator,
-			sizeof(axis2_wsdl_binding_fault_impl_t));
+	binding_fault_impl = (axis2_wsdl_binding_fault_impl_t *) 
+        AXIS2_MALLOC((*env)->allocator, sizeof(axis2_wsdl_binding_fault_impl_t));
 	
 	
 	if(NULL == binding_fault_impl)
+    {
         AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL); 
+        return NULL;
+    }
 	
+    binding_fault_impl->ref = NULL;
+    binding_fault_impl->binding_fault.extensible_component = NULL;
+    binding_fault_impl->binding_fault.ops = NULL;
+    
     binding_fault_impl->binding_fault.extensible_component = 
         axis2_wsdl_extensible_component_create(env);
  
     if(NULL == binding_fault_impl->binding_fault.extensible_component)
     {
-        AXIS2_FREE((*env)->allocator, binding_fault_impl);
+        axis2_binding_fault_free(&(binding_fault_impl->binding_fault), env);
 		AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
+        return NULL;
     }
     
 	binding_fault_impl->binding_fault.ops = 
 		AXIS2_MALLOC ((*env)->allocator, sizeof(axis2_wsdl_binding_fault_ops_t));
 	if(NULL == binding_fault_impl->binding_fault.ops)
     {
-        AXIS2_FREE((*env)->allocator, binding_fault_impl);
+        axis2_binding_fault_free(&(binding_fault_impl->binding_fault), env);
 		AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
+        return NULL;
     }
     
 	binding_fault_impl->binding_fault.ops->free =  axis2_binding_fault_free;
@@ -87,8 +97,6 @@
     
 	binding_fault_impl->binding_fault.ops->set_ref =  
         axis2_binding_fault_set_ref;
-	
-	binding_fault_impl->ref = NULL;
     
 	return &(binding_fault_impl->binding_fault);
 }
@@ -99,21 +107,31 @@
 axis2_binding_fault_free (axis2_wsdl_binding_fault_t *binding_fault, 
                             axis2_env_t **env)
 {
+    axis2_wsdl_binding_fault_impl_t *binding_fault_impl = NULL;
+    
     AXIS2_FUNC_PARAM_CHECK(binding_fault, env, AXIS2_FAILURE);
+    
+    binding_fault_impl = AXIS2_INTF_TO_IMPL(binding_fault);
 	if(NULL != binding_fault->ops)
+    {
         AXIS2_FREE((*env)->allocator, binding_fault->ops);
+        binding_fault->ops = NULL;
+    }
     
-    if(NULL != AXIS2_INTF_TO_IMPL(binding_fault)->ref)
+    if(NULL != binding_fault_impl->ref)
     {
-        AXIS2_QNAME_FREE(AXIS2_INTF_TO_IMPL(binding_fault)->ref, env);
+        AXIS2_QNAME_FREE(binding_fault_impl->ref, env);
+        binding_fault_impl->ref = NULL;
     }
     
     if(NULL != binding_fault->extensible_component)
-        AXIS2_WSDL_EXTENSIBLE_COMPONENT_FREE(binding_fault->
-            extensible_component, env);
-    
-    AXIS2_FREE((*env)->allocator, AXIS2_INTF_TO_IMPL(binding_fault));
-    
+    {
+        AXIS2_WSDL_EXTENSIBLE_COMPONENT_FREE(binding_fault->extensible_component, env);
+        binding_fault->extensible_component = NULL;
+    }
+    if(binding_fault_impl)
+        AXIS2_FREE((*env)->allocator, binding_fault_impl);
+    binding_fault_impl = NULL;
 	return AXIS2_SUCCESS;
 }
     

Modified: webservices/axis2/trunk/c/modules/wsdl/src/wsdl_binding_msg_ref.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/wsdl/src/wsdl_binding_msg_ref.c?rev=356124&r1=356123&r2=356124&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/wsdl/src/wsdl_binding_msg_ref.c (original)
+++ webservices/axis2/trunk/c/modules/wsdl/src/wsdl_binding_msg_ref.c Sun Dec 11 19:13:55 2005
@@ -70,33 +70,44 @@
 axis2_wsdl_binding_msg_ref_t * AXIS2_CALL 
 axis2_wsdl_binding_msg_ref_create (axis2_env_t **env)
 {
+    axis2_wsdl_binding_msg_ref_impl_t *binding_msg_ref_impl = NULL;
+    
 	AXIS2_ENV_CHECK(env, NULL);
 	
-	axis2_wsdl_binding_msg_ref_impl_t *binding_msg_ref_impl = 
-		(axis2_wsdl_binding_msg_ref_impl_t *) AXIS2_MALLOC((*env)->allocator,
-			sizeof(axis2_wsdl_binding_msg_ref_impl_t));
+	binding_msg_ref_impl = (axis2_wsdl_binding_msg_ref_impl_t *) 
+        AXIS2_MALLOC((*env)->allocator, sizeof(axis2_wsdl_binding_msg_ref_impl_t));
 	
 	
 	if(NULL == binding_msg_ref_impl)
+    {
         AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL); 
-    	
+        return NULL;
+    }
+    
+    binding_msg_ref_impl->msg_label = NULL;
+    binding_msg_ref_impl->direction = NULL;
+    binding_msg_ref_impl->binding_msg_ref.extensible_component = NULL;	
+    binding_msg_ref_impl->binding_msg_ref.ops = NULL;
+    
     binding_msg_ref_impl->binding_msg_ref.extensible_component = 
         axis2_wsdl_extensible_component_create(env);
  
     if(NULL == binding_msg_ref_impl->binding_msg_ref.extensible_component)
     {
-        AXIS2_FREE((*env)->allocator, binding_msg_ref_impl);
+        axis2_wsdl_binding_msg_ref_free(&(binding_msg_ref_impl->binding_msg_ref),
+            env);
 		AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
+        return NULL;
     }
     
 	binding_msg_ref_impl->binding_msg_ref.ops = 
 		AXIS2_MALLOC ((*env)->allocator, sizeof(axis2_wsdl_binding_msg_ref_ops_t));
 	if(NULL == binding_msg_ref_impl->binding_msg_ref.ops)
     {
-        AXIS2_WSDL_EXTENSIBLE_COMPONENT_FREE(binding_msg_ref_impl->binding_msg_ref.
-            extensible_component, env);
-        AXIS2_FREE((*env)->allocator, binding_msg_ref_impl);
+        axis2_wsdl_binding_msg_ref_free(&(binding_msg_ref_impl->binding_msg_ref),
+            env);
 		AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
+        return NULL;
     }
     
 	binding_msg_ref_impl->binding_msg_ref.ops->free =  axis2_wsdl_binding_msg_ref_free;
@@ -112,9 +123,6 @@
     
 	binding_msg_ref_impl->binding_msg_ref.ops->set_msg_label =  
         axis2_wsdl_binding_msg_ref_set_msg_label;
-	
-	binding_msg_ref_impl->msg_label = NULL;
-    binding_msg_ref_impl->direction = NULL;
     
 	return &(binding_msg_ref_impl->binding_msg_ref);
 }
@@ -125,26 +133,37 @@
 axis2_wsdl_binding_msg_ref_free (axis2_wsdl_binding_msg_ref_t *binding_msg_ref, 
                             axis2_env_t **env)
 {
+    axis2_wsdl_binding_msg_ref_impl_t *binding_msg_ref_impl = NULL;
+    
     AXIS2_FUNC_PARAM_CHECK(binding_msg_ref, env, AXIS2_FAILURE);
+    
+    binding_msg_ref_impl = AXIS2_INTF_TO_IMPL(binding_msg_ref);
+    
 	if(NULL != binding_msg_ref->ops)
+    {
         AXIS2_FREE((*env)->allocator, binding_msg_ref->ops);
+        binding_msg_ref->ops = NULL;
+    }
     
-    if(NULL != AXIS2_INTF_TO_IMPL(binding_msg_ref)->msg_label)
+    if(NULL != binding_msg_ref_impl->msg_label)
     {
-        AXIS2_FREE((*env)->allocator, AXIS2_INTF_TO_IMPL(binding_msg_ref)->msg_label);
+        AXIS2_FREE((*env)->allocator, binding_msg_ref_impl->msg_label);
+        binding_msg_ref_impl->msg_label = NULL;
     }
     
-    if(NULL != AXIS2_INTF_TO_IMPL(binding_msg_ref)->msg_label)
+    if(NULL != binding_msg_ref_impl->direction)
     {
-        AXIS2_FREE((*env)->allocator, AXIS2_INTF_TO_IMPL(binding_msg_ref)->msg_label);
+        AXIS2_FREE((*env)->allocator, binding_msg_ref_impl->direction);
+        binding_msg_ref_impl->direction = NULL;
     }
     
     if(NULL != binding_msg_ref->extensible_component)
         AXIS2_WSDL_EXTENSIBLE_COMPONENT_FREE(binding_msg_ref->
             extensible_component, env);
     
-    AXIS2_FREE((*env)->allocator, AXIS2_INTF_TO_IMPL(binding_msg_ref));
-    
+    if(binding_msg_ref_impl)
+        AXIS2_FREE((*env)->allocator, binding_msg_ref_impl);
+    binding_msg_ref_impl = NULL;
 	return AXIS2_SUCCESS;
 }
 
@@ -161,9 +180,19 @@
                                             axis2_env_t **env,
                                             axis2_char_t *direction) 
 {
+    axis2_wsdl_binding_msg_ref_impl_t *binding_msg_ref_impl = NULL;
+    
     AXIS2_FUNC_PARAM_CHECK(binding_msg_ref, env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, direction, AXIS2_FAILURE);
-    AXIS2_INTF_TO_IMPL(binding_msg_ref)->direction = direction;
+    
+    binding_msg_ref_impl = AXIS2_INTF_TO_IMPL(binding_msg_ref);
+    
+    if(binding_msg_ref_impl->direction)
+    {
+        AXIS2_FREE((*env)->allocator, binding_msg_ref_impl->direction);
+        binding_msg_ref_impl->direction = NULL;
+    }
+    binding_msg_ref_impl->direction = direction;
     return AXIS2_SUCCESS;
 }
 
@@ -180,8 +209,18 @@
                                             axis2_env_t **env,
                                             axis2_char_t *msg_label) 
 {
+    axis2_wsdl_binding_msg_ref_impl_t *binding_msg_ref_impl = NULL;
+    
     AXIS2_FUNC_PARAM_CHECK(binding_msg_ref, env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, msg_label, AXIS2_FAILURE);
+    
+    binding_msg_ref_impl = AXIS2_INTF_TO_IMPL(binding_msg_ref);
+    
+    if(binding_msg_ref_impl->msg_label)
+    {
+        AXIS2_FREE((*env)->allocator, binding_msg_ref_impl->msg_label);
+        binding_msg_ref_impl->direction = NULL;
+    }
     AXIS2_INTF_TO_IMPL(binding_msg_ref)->msg_label = msg_label;
     return AXIS2_SUCCESS;
 }

Modified: webservices/axis2/trunk/c/modules/wsdl/src/wsdl_binding_operation.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/wsdl/src/wsdl_binding_operation.c?rev=356124&r1=356123&r2=356124&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/wsdl/src/wsdl_binding_operation.c (original)
+++ webservices/axis2/trunk/c/modules/wsdl/src/wsdl_binding_operation.c Sun Dec 11 19:13:55 2005
@@ -38,6 +38,7 @@
      * Field output
      */
     struct axis2_wsdl_binding_msg_ref *output;
+        
 } axis2_wsdl_binding_operation_impl_t;
 
 #define AXIS2_INTF_TO_IMPL(wsdl_binding_operation) \
@@ -89,12 +90,12 @@
 axis2_status_t AXIS2_CALL
 axis2_wsdl_binding_operation_add_infault(axis2_wsdl_binding_operation_t *binding_operation,
                                             axis2_env_t **env,
-                                            axis2_wsdl_binding_fault_t *infault);
+                                            struct axis2_wsdl_binding_fault *infault);
 
 axis2_status_t AXIS2_CALL
 axis2_wsdl_binding_operation_add_outfault(axis2_wsdl_binding_operation_t *binding_operation,
                                             axis2_env_t **env,
-                                            axis2_wsdl_binding_fault_t *outfault);
+                                            struct axis2_wsdl_binding_fault *outfault);
 
 axis2_linked_list_t * AXIS2_CALL
 axis2_wsdl_binding_operation_get_infaults(axis2_wsdl_binding_operation_t *binding_operation,
@@ -120,37 +121,46 @@
 axis2_wsdl_binding_operation_t * AXIS2_CALL 
 axis2_wsdl_binding_operation_create (axis2_env_t **env)
 {
+    axis2_wsdl_binding_operation_impl_t *binding_operation_impl = NULL;
+    
     AXIS2_ENV_CHECK(env, NULL);
     
-	axis2_wsdl_binding_operation_impl_t *binding_operation_impl = 
-        (axis2_wsdl_binding_operation_impl_t *) AXIS2_MALLOC ((*env)->allocator, 
-        sizeof(axis2_wsdl_binding_operation_impl_t));
+	binding_operation_impl = (axis2_wsdl_binding_operation_impl_t *) 
+        AXIS2_MALLOC ((*env)->allocator, sizeof(axis2_wsdl_binding_operation_impl_t));
     
 	if(NULL == binding_operation_impl)
 	{
 		AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
+        return NULL;
 	}
     
     binding_operation_impl->qname = NULL;
     binding_operation_impl->operation = NULL;
     binding_operation_impl->input = NULL;
     binding_operation_impl->output = NULL;
+    binding_operation_impl->infaults = NULL;
+    binding_operation_impl->outfaults = NULL;
+    binding_operation_impl->binding_operation.extensible_component = NULL;
+    binding_operation_impl->binding_operation.ops = NULL;
 	
     binding_operation_impl->infaults = axis2_linked_list_create (env);
     
 	if(NULL == binding_operation_impl->infaults)
 	{
-		AXIS2_FREE ((*env)->allocator, binding_operation_impl);
-		AXIS2_ERROR_SET ((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);	
+		axis2_wsdl_binding_operation_free(&(binding_operation_impl->binding_operation),
+            env);
+		AXIS2_ERROR_SET ((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
+        return NULL;        
 	}
     
     binding_operation_impl->outfaults = axis2_linked_list_create (env);
     
 	if(NULL == binding_operation_impl->outfaults)
 	{
-        AXIS2_LINKED_LIST_FREE(binding_operation_impl->infaults, env);
-		AXIS2_FREE ((*env)->allocator, binding_operation_impl);
+        axis2_wsdl_binding_operation_free(&(binding_operation_impl->binding_operation),
+            env);
 		AXIS2_ERROR_SET ((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);	
+        return NULL;
 	}
     
     binding_operation_impl->binding_operation.extensible_component = 
@@ -158,10 +168,10 @@
     
 	if(NULL == binding_operation_impl->binding_operation.extensible_component)
 	{
-        AXIS2_LINKED_LIST_FREE(binding_operation_impl->infaults, env);
-        AXIS2_LINKED_LIST_FREE(binding_operation_impl->outfaults, env);
-		AXIS2_FREE ((*env)->allocator, binding_operation_impl);
-		AXIS2_ERROR_SET ((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);	
+        axis2_wsdl_binding_operation_free(&(binding_operation_impl->binding_operation),
+            env);
+		AXIS2_ERROR_SET ((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
+        return NULL;        
 	}
     
 	binding_operation_impl->binding_operation.ops = (axis2_wsdl_binding_operation_ops_t *)
@@ -169,12 +179,10 @@
     
 	if(NULL == binding_operation_impl->binding_operation.ops)
 	{
-        AXIS2_LINKED_LIST_FREE(binding_operation_impl->infaults, env);
-        AXIS2_LINKED_LIST_FREE(binding_operation_impl->outfaults, env);
-        AXIS2_WSDL_EXTENSIBLE_COMPONENT_FREE(binding_operation_impl->
-            binding_operation.extensible_component, env);
-		AXIS2_FREE ((*env)->allocator, binding_operation_impl);
-		AXIS2_ERROR_SET ((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);	
+        axis2_wsdl_binding_operation_free(&(binding_operation_impl->binding_operation),
+            env);
+		AXIS2_ERROR_SET ((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
+        return NULL;        
 	}
     
 	binding_operation_impl->binding_operation.ops->free = axis2_wsdl_binding_operation_free;
@@ -231,24 +239,69 @@
                             axis2_env_t **env)
 {
     axis2_wsdl_binding_operation_impl_t *binding_operation_impl = NULL;
+    
     AXIS2_FUNC_PARAM_CHECK(binding_operation, env, AXIS2_FAILURE);
     
     binding_operation_impl = AXIS2_INTF_TO_IMPL(binding_operation);
     
 	if(NULL != binding_operation->ops)
+    {
         AXIS2_FREE((*env)->allocator, binding_operation->ops);
+        binding_operation->ops = NULL;
+    }
     
     if(NULL != binding_operation_impl->infaults)
-       AXIS2_LINKED_LIST_FREE(binding_operation_impl->infaults, env);
+    {
+        void *val = NULL;
+        int i = 0;
+        for (i = 0; i < AXIS2_LINKED_LIST_SIZE(binding_operation_impl->infaults, env); i++)
+        {
+            struct axis2_wsdl_binding_fault *binding_fault = NULL;
+            binding_fault = AXIS2_LINKED_LIST_GET(binding_operation_impl->infaults, env, i);
+            
+            binding_fault = (struct axis2_wsdl_binding_fault *) val;
+            if (binding_fault)
+               AXIS2_WSDL_BINDING_FAULT_FREE (binding_fault, env);
+            
+            val = NULL;
+            binding_fault = NULL;
+               
+        }
+        AXIS2_LINKED_LIST_FREE(binding_operation_impl->infaults, env);
+        binding_operation_impl->infaults = NULL;
+    }
     
     if(NULL != binding_operation_impl->outfaults)
-       AXIS2_LINKED_LIST_FREE(binding_operation_impl->outfaults, env);
+    {
+        void *val = NULL;
+        int i = 0;
+        for (i = 0; i < AXIS2_LINKED_LIST_SIZE(binding_operation_impl->outfaults, env); i++)
+        {
+            struct axis2_wsdl_binding_fault *binding_fault = NULL;
+            binding_fault = AXIS2_LINKED_LIST_GET(binding_operation_impl->outfaults, env, i);
+            
+            binding_fault = (struct axis2_wsdl_binding_fault *) val;
+            if (binding_fault)
+               AXIS2_WSDL_BINDING_FAULT_FREE (binding_fault, env);
+            
+            val = NULL;
+            binding_fault = NULL;
+               
+        }
+        AXIS2_LINKED_LIST_FREE(binding_operation_impl->outfaults, env);
+        binding_operation_impl->outfaults = NULL;
+    }
     
     if(NULL != binding_operation->extensible_component)
+    {
         AXIS2_WSDL_EXTENSIBLE_COMPONENT_FREE(binding_operation->
             extensible_component, env);
+        binding_operation->extensible_component = NULL;
+    }
     
-    AXIS2_FREE((*env)->allocator, binding_operation_impl);
+    if(binding_operation_impl)
+        AXIS2_FREE((*env)->allocator, binding_operation_impl);
+    binding_operation_impl = NULL;
     
 	return AXIS2_SUCCESS;
 }
@@ -266,9 +319,18 @@
                                         axis2_env_t **env,
                                         struct axis2_wsdl_binding_msg_ref *input) 
 {
+    axis2_wsdl_binding_operation_impl_t *binding_operation_impl = NULL;
+    
     AXIS2_FUNC_PARAM_CHECK(binding_operation, env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, input, AXIS2_FAILURE);
-    AXIS2_INTF_TO_IMPL(binding_operation)->input = input;
+    
+    binding_operation_impl = AXIS2_INTF_TO_IMPL(binding_operation);
+    if(binding_operation_impl->input)
+    {
+        AXIS2_WSDL_BINDING_MSG_REF_FREE(binding_operation_impl->input, env);
+        binding_operation_impl->input = NULL;
+    }
+    binding_operation_impl->input = input;
     return AXIS2_SUCCESS;
 }
 
@@ -285,8 +347,9 @@
                                             axis2_env_t **env,
                                             void *operation) 
 {
-    struct axis2_operation *ops = NULL;
     axis2_wsdl_binding_operation_impl_t *binding_operation_impl = NULL;
+    struct axis2_operation *optr = NULL;
+    
     AXIS2_FUNC_PARAM_CHECK(binding_operation, env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, operation, AXIS2_FAILURE);
     
@@ -294,8 +357,8 @@
     
     if(NULL != binding_operation_impl->operation)
     {
-        ops = (struct axis2_operation *) (binding_operation_impl->operation);
-        AXIS2_OPERATION_FREE(ops, env);
+        optr = binding_operation_impl->operation;
+        AXIS2_OPERATION_FREE(optr , env);
         binding_operation_impl->operation = NULL;
     }
     binding_operation_impl->operation = operation;
@@ -315,9 +378,18 @@
                                         axis2_env_t **env,
                                         struct axis2_wsdl_binding_msg_ref *output) 
 {
+    axis2_wsdl_binding_operation_impl_t *binding_operation_impl = NULL;
+    
     AXIS2_FUNC_PARAM_CHECK(binding_operation, env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, output, AXIS2_FAILURE);
-    AXIS2_INTF_TO_IMPL(binding_operation)->output = output;
+    
+    binding_operation_impl = AXIS2_INTF_TO_IMPL(binding_operation);
+    if(binding_operation_impl->output)
+    {
+        AXIS2_WSDL_BINDING_MSG_REF_FREE(binding_operation_impl->output, env);
+        binding_operation_impl->output = NULL;
+    }
+    binding_operation_impl->output = output;
     return AXIS2_SUCCESS;
 }
 
@@ -334,16 +406,26 @@
                                             axis2_env_t **env,
                                             axis2_qname_t *qname) 
 {
+    axis2_wsdl_binding_operation_impl_t *binding_operation_impl = NULL;
+    
     AXIS2_FUNC_PARAM_CHECK(binding_operation, env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, qname, AXIS2_FAILURE);
-    AXIS2_INTF_TO_IMPL(binding_operation)->qname = qname;
+    
+    binding_operation_impl = AXIS2_INTF_TO_IMPL(binding_operation);
+    
+    if(binding_operation_impl->qname)
+    {
+        AXIS2_QNAME_FREE(binding_operation_impl->qname, env);
+        binding_operation_impl->qname = NULL;
+    }
+    binding_operation_impl->qname = qname;
     return AXIS2_SUCCESS;
 }
 
 axis2_status_t AXIS2_CALL
 axis2_wsdl_binding_operation_add_infault(axis2_wsdl_binding_operation_t *binding_operation,
                                             axis2_env_t **env,
-                                            axis2_wsdl_binding_fault_t *infault) 
+                                            struct axis2_wsdl_binding_fault *infault) 
 {
     AXIS2_FUNC_PARAM_CHECK(binding_operation, env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, infault, AXIS2_FAILURE);
@@ -355,12 +437,16 @@
 axis2_status_t AXIS2_CALL
 axis2_wsdl_binding_operation_add_outfault(axis2_wsdl_binding_operation_t *binding_operation,
                                             axis2_env_t **env,
-                                            axis2_wsdl_binding_fault_t *outfault) 
+                                            struct axis2_wsdl_binding_fault *outfault) 
 {
+    axis2_wsdl_binding_operation_impl_t *binding_operation_impl = NULL;
+    
     AXIS2_FUNC_PARAM_CHECK(binding_operation, env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, outfault, AXIS2_FAILURE);
     
-    return AXIS2_LINKED_LIST_ADD(AXIS2_INTF_TO_IMPL(binding_operation)->outfaults,
+    binding_operation_impl = AXIS2_INTF_TO_IMPL(binding_operation);
+    
+    return AXIS2_LINKED_LIST_ADD(binding_operation_impl->outfaults,
         env, outfault);
 }
 
@@ -377,9 +463,34 @@
                                             axis2_env_t **env,
                                             axis2_linked_list_t *infaults) 
 {
+    axis2_wsdl_binding_operation_impl_t *binding_operation_impl = NULL;
+    
     AXIS2_FUNC_PARAM_CHECK(binding_operation, env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, infaults, AXIS2_FAILURE);
-    AXIS2_INTF_TO_IMPL(binding_operation)->infaults = infaults;
+    
+    binding_operation_impl = AXIS2_INTF_TO_IMPL(binding_operation);
+    
+    if(NULL != binding_operation_impl->outfaults)
+    {
+        void *val = NULL;
+        int i = 0;
+        for (i = 0; i < AXIS2_LINKED_LIST_SIZE(binding_operation_impl->outfaults, env); i++)
+        {
+            struct axis2_wsdl_binding_fault *binding_fault = NULL;
+            binding_fault = AXIS2_LINKED_LIST_GET(binding_operation_impl->outfaults, env, i);
+            
+            binding_fault = (struct axis2_wsdl_binding_fault *) val;
+            if (binding_fault)
+               AXIS2_WSDL_BINDING_FAULT_FREE (binding_fault, env);
+            
+            val = NULL;
+            binding_fault = NULL;
+               
+        }
+        AXIS2_LINKED_LIST_FREE(binding_operation_impl->outfaults, env);
+        binding_operation_impl->outfaults = NULL;
+    }
+    binding_operation_impl->infaults = infaults;
     return AXIS2_SUCCESS;
 }
 
@@ -396,8 +507,34 @@
                                             axis2_env_t **env,
                                             axis2_linked_list_t *outfaults) 
 {
+    axis2_wsdl_binding_operation_impl_t *binding_operation_impl = NULL;
+    
     AXIS2_FUNC_PARAM_CHECK(binding_operation, env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, outfaults, AXIS2_FAILURE);
-    AXIS2_INTF_TO_IMPL(binding_operation)->outfaults = outfaults;
+    
+    binding_operation_impl = AXIS2_INTF_TO_IMPL(binding_operation);
+    
+    if(NULL != binding_operation_impl->outfaults)
+    {
+        void *val = NULL;
+        int i = 0;
+        for (i = 0; i < AXIS2_LINKED_LIST_SIZE(binding_operation_impl->outfaults, env); i++)
+        {
+            struct axis2_wsdl_binding_fault *binding_fault = NULL;
+            binding_fault = AXIS2_LINKED_LIST_GET(binding_operation_impl->outfaults, env, i);
+            
+            binding_fault = (struct axis2_wsdl_binding_fault *) val;
+            if (binding_fault)
+               AXIS2_WSDL_BINDING_FAULT_FREE (binding_fault, env);
+            
+            val = NULL;
+            binding_fault = NULL;
+               
+        }
+        AXIS2_LINKED_LIST_FREE(binding_operation_impl->outfaults, env);
+        binding_operation_impl->outfaults = NULL;
+    }
+    
+    binding_operation_impl->outfaults = outfaults;
     return AXIS2_SUCCESS;
 }

Modified: webservices/axis2/trunk/c/modules/wsdl/src/wsdl_component.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/wsdl/src/wsdl_component.c?rev=356124&r1=356123&r2=356124&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/wsdl/src/wsdl_component.c (original)
+++ webservices/axis2/trunk/c/modules/wsdl/src/wsdl_component.c Sun Dec 11 19:13:55 2005
@@ -46,14 +46,14 @@
 axis2_wsdl_component_set_component_property(
 	                                    axis2_wsdl_component_t *wsdl_component, 
                                         axis2_env_t **env,
-                                        const void *key, 
+                                        void *key, 
                                         void *value);
 	
 void * AXIS2_CALL
 axis2_wsdl_component_get_component_property(
 		                                axis2_wsdl_component_t *wsdl_component,
                                         axis2_env_t **env,
-                                        const void *key);
+                                        void *key);
 
 
                                         
@@ -132,22 +132,82 @@
                             axis2_env_t **env)
 {
     axis2_wsdl_component_impl_t *component_impl = NULL;
+    
     AXIS2_FUNC_PARAM_CHECK(wsdl_component, env, AXIS2_FAILURE);
+    
     component_impl = AXIS2_INTF_TO_IMPL(wsdl_component);
     
 	if(NULL != wsdl_component->ops)
+    {
         AXIS2_FREE((*env)->allocator, wsdl_component->ops);
+        wsdl_component->ops = NULL;
+    }
     
     if(NULL != component_impl->component_properties)
+    {
+        axis2_hash_index_t *hi = NULL;
+        void *val = NULL;
+        void *key = NULL;
+        for (hi = axis2_hash_first (component_impl->component_properties, env); hi;
+                 hi = axis2_hash_next ( env, hi))
+        {
+            axis2_param_container_t *param_container = NULL;
+            axis2_array_list_t *module_desc_list = NULL;
+                
+            axis2_hash_this (hi, &key, NULL, &val);
+            
+            if(0 == AXIS2_STRCMP(PARAMETER_KEY, (axis2_char_t *)key))
+            {
+                param_container = (axis2_param_container_t *) val;
+                AXIS2_PARAM_CONTAINER_FREE(param_container, env);
+                param_container = NULL;
+            }
+            
+            if(0 == AXIS2_STRCMP(MODULEREF_KEY, (axis2_char_t *)key))
+            {
+                void *val = NULL;
+                int i = 0;
+                module_desc_list = (axis2_array_list_t *) val;
+                
+                for (i = 0; i < AXIS2_ARRAY_LIST_SIZE(module_desc_list, env); i++)
+                {
+                    struct axis2_module_desc *module_desc = NULL;
+                    module_desc = AXIS2_ARRAY_LIST_GET(module_desc_list, env, i);
+                    
+                    module_desc = (struct axis2_module_desc *) val;
+                    if (module_desc)
+                       AXIS2_MODULE_DESC_FREE (module_desc, env);
+                    
+                    val = NULL;
+                    module_desc = NULL;
+                       
+                }
+                AXIS2_ARRAY_LIST_FREE(module_desc_list, env);
+                module_desc_list = NULL;
+            }
+            
+            val = NULL;
+            key = NULL;
+               
+        }
         axis2_hash_free(component_impl->component_properties, env);
+        component_impl->component_properties = NULL;
+    }
     
     if(NULL != component_impl->attributes)
+    {
         AXIS2_LINKED_LIST_FREE(component_impl->attributes, env);
+        component_impl->attributes = NULL;
+    }
     
     if(NULL != component_impl->elements)
+    {
         AXIS2_LINKED_LIST_FREE(component_impl->elements, env);
+        component_impl->elements = NULL;
+    }
     
     AXIS2_FREE((*env)->allocator, component_impl);
+    component_impl = NULL;
     
 	return AXIS2_SUCCESS;
 }
@@ -178,7 +238,7 @@
 axis2_wsdl_component_set_component_property(
                                         axis2_wsdl_component_t *wsdl_component, 
                                         axis2_env_t **env,
-                                        const void *key, 
+                                        void *key, 
                                         void *value) 
 {
     AXIS2_FUNC_PARAM_CHECK(wsdl_component, env, AXIS2_FAILURE);
@@ -195,7 +255,7 @@
 axis2_wsdl_component_get_component_property(
 		                                axis2_wsdl_component_t *wsdl_component,
                                         axis2_env_t **env, 
-                                        const void *key) 
+                                        void *key) 
 {
     AXIS2_FUNC_PARAM_CHECK(wsdl_component, env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, key, AXIS2_FAILURE);

Modified: webservices/axis2/trunk/c/modules/wsdl/src/wsdl_endpoint.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/wsdl/src/wsdl_endpoint.c?rev=356124&r1=356123&r2=356124&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/wsdl/src/wsdl_endpoint.c (original)
+++ webservices/axis2/trunk/c/modules/wsdl/src/wsdl_endpoint.c Sun Dec 11 19:13:55 2005
@@ -68,30 +68,39 @@
 axis2_wsdl_endpoint_t * AXIS2_CALL 
 axis2_wsdl_endpoint_create (axis2_env_t **env)
 {
+    axis2_wsdl_endpoint_impl_t *wsdl_endpoint_impl = NULL;
+    
 	AXIS2_ENV_CHECK(env, NULL);
 	
-	axis2_wsdl_endpoint_impl_t *wsdl_endpoint_impl = 
-		(axis2_wsdl_endpoint_impl_t *) AXIS2_MALLOC((*env)->allocator,
+	wsdl_endpoint_impl = (axis2_wsdl_endpoint_impl_t *) AXIS2_MALLOC((*env)->allocator,
 			sizeof(axis2_wsdl_endpoint_impl_t));
 	
-	
-	if(NULL == wsdl_endpoint_impl)
+    if(NULL == wsdl_endpoint_impl)
+    {
         AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL); 
-	
+        return NULL;
+    }
+    
+    wsdl_endpoint_impl->qname = NULL;
+    wsdl_endpoint_impl->wsdl_binding = NULL;
+	wsdl_endpoint_impl->wsdl_endpoint.wsdl_component = NULL;
+    wsdl_endpoint_impl->wsdl_endpoint.ops = NULL;
+    
     wsdl_endpoint_impl->wsdl_endpoint.wsdl_component = axis2_wsdl_component_create(env);
     if(NULL == wsdl_endpoint_impl->wsdl_endpoint.wsdl_component)
     {
-        AXIS2_FREE((*env)->allocator, wsdl_endpoint_impl);
+        axis2_wsdl_endpoint_free(&(wsdl_endpoint_impl->wsdl_endpoint), env);
         AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
+        return NULL;
     }    
     
 	wsdl_endpoint_impl->wsdl_endpoint.ops = 
 		AXIS2_MALLOC ((*env)->allocator, sizeof(axis2_wsdl_endpoint_ops_t));
 	if(NULL == wsdl_endpoint_impl->wsdl_endpoint.ops)
     {
-        AXIS2_WSDL_FEATURE_FREE(wsdl_endpoint_impl->wsdl_endpoint.wsdl_component, env);
-        AXIS2_FREE((*env)->allocator, wsdl_endpoint_impl);
+        axis2_wsdl_endpoint_free(&(wsdl_endpoint_impl->wsdl_endpoint), env);
 		AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
+        return NULL;
     }
     
 	wsdl_endpoint_impl->wsdl_endpoint.ops->free =  axis2_wsdl_endpoint_free;
@@ -104,9 +113,6 @@
     wsdl_endpoint_impl->wsdl_endpoint.ops->set_binding = 
         axis2_wsdl_endpoint_set_binding;
 	
-	wsdl_endpoint_impl->qname = NULL;
-    wsdl_endpoint_impl->wsdl_binding = NULL;
-	
 	return &(wsdl_endpoint_impl->wsdl_endpoint);
 }
 
@@ -116,26 +122,39 @@
 axis2_wsdl_endpoint_free (axis2_wsdl_endpoint_t *wsdl_endpoint, 
                             axis2_env_t **env)
 {
+    axis2_wsdl_endpoint_impl_t *wsdl_endpoint_impl = NULL;
+    
     AXIS2_FUNC_PARAM_CHECK(wsdl_endpoint, env, AXIS2_FAILURE);
+    
+    wsdl_endpoint_impl = AXIS2_INTF_TO_IMPL(wsdl_endpoint);
+    
 	if(NULL != wsdl_endpoint->ops)
+    {
         AXIS2_FREE((*env)->allocator, wsdl_endpoint->ops);
+        wsdl_endpoint->ops = NULL;
+    }
     
     if(NULL != AXIS2_INTF_TO_IMPL(wsdl_endpoint)->qname)
     {
-        AXIS2_FREE((*env)->allocator, AXIS2_INTF_TO_IMPL(wsdl_endpoint)->qname);
+        AXIS2_FREE((*env)->allocator, wsdl_endpoint_impl->qname);
+        wsdl_endpoint_impl->qname = NULL;
     }
     
     if(NULL != AXIS2_INTF_TO_IMPL(wsdl_endpoint)->wsdl_binding)
     {
-        AXIS2_WSDL_BINDING_FREE(AXIS2_INTF_TO_IMPL(wsdl_endpoint)->wsdl_binding, env);
+        AXIS2_WSDL_BINDING_FREE(wsdl_endpoint_impl->wsdl_binding, env);
+        wsdl_endpoint_impl->wsdl_binding = NULL;
     }
     
     if(NULL != wsdl_endpoint->wsdl_component)
     {
         AXIS2_WSDL_COMPONENT_FREE(wsdl_endpoint->wsdl_component, env);
+        wsdl_endpoint->wsdl_component = NULL;
     }
     
-    AXIS2_FREE((*env)->allocator, AXIS2_INTF_TO_IMPL(wsdl_endpoint));
+    if(wsdl_endpoint_impl)
+        AXIS2_FREE((*env)->allocator, wsdl_endpoint_impl);
+    wsdl_endpoint_impl = NULL;
     
 	return AXIS2_SUCCESS;
 }
@@ -163,9 +182,18 @@
                                 axis2_env_t **env,
                                 axis2_qname_t *qname) 
 {
+    axis2_wsdl_endpoint_impl_t *wsdl_endpoint_impl = NULL;
+    
     AXIS2_FUNC_PARAM_CHECK(wsdl_endpoint, env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, qname, AXIS2_FAILURE);
-    AXIS2_INTF_TO_IMPL(wsdl_endpoint)->qname = qname;
+    
+    wsdl_endpoint_impl = AXIS2_INTF_TO_IMPL(wsdl_endpoint);
+    if(wsdl_endpoint_impl->qname)
+    {
+        AXIS2_QNAME_FREE(wsdl_endpoint_impl->qname, env);
+        wsdl_endpoint_impl->qname = NULL;
+    }
+    wsdl_endpoint_impl->qname = qname;
     return AXIS2_SUCCESS;
 }
 
@@ -192,7 +220,17 @@
                                 axis2_env_t **env,
                                 struct axis2_wsdl_binding *wsdl_binding) 
 {
+    axis2_wsdl_endpoint_impl_t *wsdl_endpoint_impl = NULL;
+    
     AXIS2_FUNC_PARAM_CHECK(wsdl_endpoint, env, AXIS2_FAILURE);
-    AXIS2_INTF_TO_IMPL(wsdl_endpoint)->wsdl_binding = wsdl_binding;
+    AXIS2_PARAM_CHECK((*env)->error, wsdl_binding, AXIS2_FAILURE);
+    
+    wsdl_endpoint_impl = AXIS2_INTF_TO_IMPL(wsdl_endpoint);
+    if(wsdl_endpoint_impl->wsdl_binding)
+    {
+        AXIS2_WSDL_BINDING_FREE(wsdl_endpoint_impl->wsdl_binding, env);
+        wsdl_endpoint_impl->wsdl_binding = NULL;
+    }
+    wsdl_endpoint_impl->wsdl_binding = wsdl_binding;
     return AXIS2_SUCCESS;
 }

Modified: webservices/axis2/trunk/c/modules/wsdl/src/wsdl_extensible_component.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/wsdl/src/wsdl_extensible_component.c?rev=356124&r1=356123&r2=356124&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/wsdl/src/wsdl_extensible_component.c (original)
+++ webservices/axis2/trunk/c/modules/wsdl/src/wsdl_extensible_component.c Sun Dec 11 19:13:55 2005
@@ -73,16 +73,53 @@
 axis2_wsdl_extensible_component_t * AXIS2_CALL 
 axis2_wsdl_extensible_component_create (axis2_env_t **env)
 {
+    axis2_wsdl_extensible_component_impl_t *extensible_component_impl = NULL;
 	AXIS2_ENV_CHECK(env, NULL);
 	
-	axis2_wsdl_extensible_component_impl_t *extensible_component_impl = 
-		(axis2_wsdl_extensible_component_impl_t *) AXIS2_MALLOC((*env)->allocator,
-			sizeof(axis2_wsdl_extensible_component_impl_t));
+	extensible_component_impl = (axis2_wsdl_extensible_component_impl_t *) 
+        AXIS2_MALLOC((*env)->allocator, sizeof(axis2_wsdl_extensible_component_impl_t));
 	
 	
 	if(NULL == extensible_component_impl)
-        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL); 
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
+        return NULL;        
+    }
 	
+    extensible_component_impl->extensible_component.ops = NULL;
+    extensible_component_impl->properties = NULL;
+    extensible_component_impl->features = NULL;
+    extensible_component_impl->extensible_component.wsdl_component = NULL;
+    
+    extensible_component_impl->features = axis2_linked_list_create(env);
+    if(NULL == extensible_component_impl->features)
+    {
+        axis2_wsdl_extensible_component_free(&(extensible_component_impl->
+            extensible_component), env);
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
+        return NULL;
+    }
+    
+    extensible_component_impl->properties = axis2_linked_list_create(env);
+    if(NULL == extensible_component_impl->properties)
+    {
+        axis2_wsdl_extensible_component_free(&(extensible_component_impl->
+            extensible_component), env);
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
+        return NULL;
+    }
+    
+    extensible_component_impl->extensible_component.wsdl_component = 
+            axis2_wsdl_component_create(env);
+    if(NULL == extensible_component_impl->extensible_component.wsdl_component)
+    {
+        axis2_wsdl_extensible_component_free(&(extensible_component_impl->
+            extensible_component), env);
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
+        return NULL;
+    }
+    
+    
 	extensible_component_impl->extensible_component.ops = 
 		AXIS2_MALLOC ((*env)->allocator, sizeof(axis2_wsdl_extensible_component_ops_t));
 	if(NULL == extensible_component_impl->extensible_component.ops)
@@ -101,35 +138,7 @@
         axis2_wsdl_extensible_component_add_property;
     extensible_component_impl->extensible_component.ops->get_properties = 
         axis2_wsdl_extensible_component_get_properties;
-	
-	extensible_component_impl->features = axis2_linked_list_create(env);
-    if(NULL == extensible_component_impl->features)
-    {
-        AXIS2_FREE((*env)->allocator, extensible_component_impl->extensible_component.ops);
-        AXIS2_FREE((*env)->allocator, extensible_component_impl);
-        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
-    }
-    
-    extensible_component_impl->properties = axis2_linked_list_create(env);
-    if(NULL == extensible_component_impl->properties)
-    {
-        AXIS2_LINKED_LIST_FREE(extensible_component_impl->features, env);
-        AXIS2_FREE((*env)->allocator, extensible_component_impl->
-            extensible_component.ops);
-        AXIS2_FREE((*env)->allocator, extensible_component_impl);
-        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
-    }
-    
-    extensible_component_impl->extensible_component.wsdl_component = axis2_wsdl_component_create(env);
-    if(NULL == extensible_component_impl->extensible_component.wsdl_component)
-    {
-        AXIS2_LINKED_LIST_FREE(extensible_component_impl->properties, env);
-        AXIS2_LINKED_LIST_FREE(extensible_component_impl->features, env);
-        AXIS2_FREE((*env)->allocator, extensible_component_impl->
-            extensible_component.ops);
-        AXIS2_FREE((*env)->allocator, extensible_component_impl);
-        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
-    }    
+	   
 	
 	return &(extensible_component_impl->extensible_component);
 }
@@ -141,28 +150,69 @@
                         axis2_wsdl_extensible_component_t *extensible_component, 
                         axis2_env_t **env)
 {
+    axis2_wsdl_extensible_component_impl_t *extensible_component_impl = NULL;
+    
     AXIS2_FUNC_PARAM_CHECK(extensible_component, env, AXIS2_FAILURE);
+    
+    extensible_component_impl = AXIS2_INTF_TO_IMPL(extensible_component);
+    
 	if(NULL != extensible_component->ops)
+    {
         AXIS2_FREE((*env)->allocator, extensible_component->ops);
+        extensible_component->ops = NULL;
+    }
     
-    if(NULL != AXIS2_INTF_TO_IMPL(extensible_component)->features)
+    if(NULL != extensible_component_impl->features)
     {
-        AXIS2_LINKED_LIST_FREE(AXIS2_INTF_TO_IMPL(extensible_component)->
-            features, env);
+        void *val = NULL;
+        int i = 0;
+        for (i = 0; i < AXIS2_LINKED_LIST_SIZE(extensible_component_impl->features, env); i++)
+        {
+            axis2_wsdl_feature_t *feature = NULL;
+            feature = AXIS2_LINKED_LIST_GET(extensible_component_impl->features, env, i);
+            
+            feature = (axis2_wsdl_feature_t *) val;
+            if (feature)
+               AXIS2_WSDL_FEATURE_FREE (feature, env);
+            
+            val = NULL;
+            feature = NULL;
+               
+        }
+        AXIS2_LINKED_LIST_FREE(extensible_component_impl->features, env);
+        extensible_component_impl->features = NULL;
     }
     
-    if(NULL != AXIS2_INTF_TO_IMPL(extensible_component)->properties)
+    if(NULL != extensible_component_impl->properties)
     {
-        AXIS2_LINKED_LIST_FREE(AXIS2_INTF_TO_IMPL(extensible_component)->
-            properties, env);
+        void *val = NULL;
+        int i = 0;
+        for (i = 0; i < AXIS2_LINKED_LIST_SIZE(extensible_component_impl->properties, env); i++)
+        {
+            axis2_wsdl_property_t *property = NULL;
+            property = AXIS2_LINKED_LIST_GET(extensible_component_impl->properties, env, i);
+            
+            property = (axis2_wsdl_property_t *) val;
+            if (property)
+               AXIS2_WSDL_PROPERTY_FREE(property, env);
+            
+            val = NULL;
+            property = NULL;
+               
+        }
+        AXIS2_LINKED_LIST_FREE(extensible_component_impl->properties, env);
+        extensible_component_impl->properties = NULL;
     }
     
     if(NULL != extensible_component->wsdl_component)
     {
         AXIS2_WSDL_COMPONENT_FREE(extensible_component->wsdl_component, env);
+        extensible_component->wsdl_component = NULL;
     }
     
-    AXIS2_FREE((*env)->allocator, AXIS2_INTF_TO_IMPL(extensible_component));
+    if(extensible_component_impl)
+        AXIS2_FREE((*env)->allocator, extensible_component_impl);
+    extensible_component_impl = NULL;
     
 	return AXIS2_SUCCESS;
 }
@@ -173,17 +223,21 @@
                         axis2_env_t **env,
                         axis2_wsdl_feature_t *wsdl_feature) 
 {
+    axis2_wsdl_extensible_component_impl_t *extensible_component_impl = NULL;
+    
     AXIS2_FUNC_PARAM_CHECK(extensible_component, env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, wsdl_feature, AXIS2_FAILURE);
     
-    if (NULL == AXIS2_INTF_TO_IMPL(extensible_component)->features) 
+    extensible_component_impl = AXIS2_INTF_TO_IMPL(extensible_component);
+    
+    if (NULL == extensible_component_impl->features) 
     {
-        AXIS2_INTF_TO_IMPL(extensible_component)->features = 
-            axis2_linked_list_create(env);
+        extensible_component_impl->features = axis2_linked_list_create(env);
+        if(!extensible_component_impl->features)
+            return AXIS2_FAILURE;
     }
     
-    return AXIS2_LINKED_LIST_ADD(AXIS2_INTF_TO_IMPL(extensible_component)->features,
-        env, wsdl_feature);
+    return AXIS2_LINKED_LIST_ADD(extensible_component_impl->features, env, wsdl_feature);
 }
 
 axis2_linked_list_t *AXIS2_CALL
@@ -193,10 +247,6 @@
 {
     AXIS2_FUNC_PARAM_CHECK(extensible_component, env, NULL);
     
-    if (NULL == AXIS2_INTF_TO_IMPL(extensible_component)->features) 
-    {
-        return axis2_linked_list_create(env);
-    }
     return AXIS2_INTF_TO_IMPL(extensible_component)->features;
 }
 
@@ -206,16 +256,21 @@
                         axis2_env_t **env,
                         axis2_wsdl_property_t *wsdl_property) 
 {
+    axis2_wsdl_extensible_component_impl_t *extensible_component_impl = NULL;
+    
     AXIS2_FUNC_PARAM_CHECK(extensible_component, env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK((*env)->error, wsdl_property, AXIS2_FAILURE);
-    if (NULL == AXIS2_INTF_TO_IMPL(extensible_component)->properties) 
+    
+    extensible_component_impl = AXIS2_INTF_TO_IMPL(extensible_component);
+    
+    if (NULL == extensible_component_impl->properties) 
     {
-        AXIS2_INTF_TO_IMPL(extensible_component)->properties =
-            axis2_linked_list_create(env);
+        extensible_component_impl->properties = axis2_linked_list_create(env);
+        if(!extensible_component_impl->properties)
+            return AXIS2_FAILURE;
     }
     
-    return  AXIS2_LINKED_LIST_ADD(AXIS2_INTF_TO_IMPL(extensible_component)->
-        features, env, wsdl_property);
+    return  AXIS2_LINKED_LIST_ADD(extensible_component_impl->features, env, wsdl_property);
 }
 
 axis2_linked_list_t *AXIS2_CALL
@@ -225,9 +280,5 @@
 {
     AXIS2_FUNC_PARAM_CHECK(extensible_component, env, NULL);
     
-    if (NULL == AXIS2_INTF_TO_IMPL(extensible_component)->properties) 
-    {
-        return axis2_linked_list_create(env);
-    }
     return AXIS2_INTF_TO_IMPL(extensible_component)->properties;
 }

Modified: webservices/axis2/trunk/c/modules/wsdl/src/wsdl_extensible_element.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/wsdl/src/wsdl_extensible_element.c?rev=356124&r1=356123&r2=356124&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/wsdl/src/wsdl_extensible_element.c (original)
+++ webservices/axis2/trunk/c/modules/wsdl/src/wsdl_extensible_element.c Sun Dec 11 19:13:55 2005
@@ -67,15 +67,22 @@
 axis2_wsdl_extensible_element_t * AXIS2_CALL 
 axis2_wsdl_extensible_element_create (axis2_env_t **env)
 {
+    axis2_wsdl_extensible_element_impl_t *extensible_element_impl = NULL;
+    
 	AXIS2_ENV_CHECK(env, NULL);
 	
-	axis2_wsdl_extensible_element_impl_t *extensible_element_impl = 
-		(axis2_wsdl_extensible_element_impl_t *) AXIS2_MALLOC((*env)->allocator,
-			sizeof(axis2_wsdl_extensible_element_impl_t));
+	extensible_element_impl = (axis2_wsdl_extensible_element_impl_t *) 
+        AXIS2_MALLOC((*env)->allocator, sizeof(axis2_wsdl_extensible_element_impl_t));
 	
 	
 	if(NULL == extensible_element_impl)
-        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL); 
+    {
+        AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
+        return NULL;        
+    }
+    
+    extensible_element_impl->type = NULL;
+    extensible_element_impl->extensible_element.ops = NULL;
     
 	extensible_element_impl->extensible_element.ops = 
 		AXIS2_MALLOC ((*env)->allocator, sizeof(axis2_wsdl_extensible_element_ops_t));
@@ -84,6 +91,7 @@
         axis2_wsdl_extensible_element_free(&(extensible_element_impl->
             extensible_element), env);
 		AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, NULL);
+        return NULL;
     }
     
     extensible_element_impl->extensible_element.ops->free =  
@@ -98,7 +106,6 @@
 	extensible_element_impl->extensible_element.ops->set_type = 
         axis2_wsdl_extensible_element_set_type;
 	
-    extensible_element_impl->type = NULL;
     
 	return &(extensible_element_impl->extensible_element);
 }
@@ -118,6 +125,8 @@
     {
         AXIS2_QNAME_FREE(AXIS2_INTF_TO_IMPL(extensible_element)->
             type, env);
+        AXIS2_INTF_TO_IMPL(extensible_element)->type = NULL;
+        
     }
     
     AXIS2_FREE((*env)->allocator, AXIS2_INTF_TO_IMPL(extensible_element));
@@ -168,7 +177,10 @@
     AXIS2_PARAM_CHECK((*env)->error, type, AXIS2_FAILURE);
     
     if(extensible_element_impl->type)
+    {
         AXIS2_QNAME_FREE(extensible_element_impl->type, env);
+        extensible_element_impl->type = NULL;
+    }
     
     extensible_element_impl->type = type;
     return AXIS2_SUCCESS;