You are viewing a plain text version of this content. The canonical link for it is here.
Posted to sandesha-dev@ws.apache.org by da...@apache.org on 2008/07/30 17:52:58 UTC

svn commit: r681094 - in /webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src: msgprocessors/app_msg_processor.c util/msg_creator.c util/seq_mgr.c wsrm/create_seq.c wsrm/seq_offer.c wsrm/sequence.c

Author: damitha
Date: Wed Jul 30 08:52:57 2008
New Revision: 681094

URL: http://svn.apache.org/viewvc?rev=681094&view=rev
Log:
Fixing memory leaks

Modified:
    webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/app_msg_processor.c
    webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/msg_creator.c
    webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/seq_mgr.c
    webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/wsrm/create_seq.c
    webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/wsrm/seq_offer.c
    webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/wsrm/sequence.c

Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/app_msg_processor.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/app_msg_processor.c?rev=681094&r1=681093&r2=681094&view=diff
==============================================================================
--- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/app_msg_processor.c (original)
+++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/msgprocessors/app_msg_processor.c Wed Jul 30 08:52:57 2008
@@ -1448,6 +1448,7 @@
         if(!create_seq_added)
         {
             axis2_char_t *acks_to = NULL;
+            sandesha2_seq_property_bean_t *reply_to_epr_bean = NULL;
             
             create_seq_added = sandesha2_seq_property_bean_create_with_data(env, 
                     internal_sequence_id, SANDESHA2_SEQ_PROP_OUT_CREATE_SEQ_SENT, AXIS2_VALUE_TRUE);
@@ -1477,29 +1478,28 @@
             
             if(!acks_to && is_svr_side)
             {
-                sandesha2_seq_property_bean_t *reply_to_epr_bean = NULL;
-                
                 reply_to_epr_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env, 
                         rmd_sequence_id, SANDESHA2_SEQ_PROP_REPLY_TO_EPR);
                 if(reply_to_epr_bean)
                 {
-                    axis2_endpoint_ref_t *acks_epr = NULL;
-
-                    acks_epr = axis2_endpoint_ref_create(env, 
-                            sandesha2_seq_property_bean_get_value(reply_to_epr_bean, env));
-                    if(acks_epr)
-                    {
-                        acks_to = (axis2_char_t*)axis2_endpoint_ref_get_address(acks_epr, env);
-                    }
+                    acks_to = sandesha2_seq_property_bean_get_value(reply_to_epr_bean, env);
                 }
             }
+
             /**
              * else if()
              * TODO handle acks_to == anon_uri case
              */
             sandesha2_app_msg_processor_send_create_seq_msg(env, rm_msg_ctx, internal_sequence_id, 
                     acks_to, storage_mgr, seq_prop_mgr, create_seq_mgr, sender_mgr);
+            
+            if(reply_to_epr_bean)
+            {
+                sandesha2_seq_property_bean_free(reply_to_epr_bean, env);
+            }
         }
+        
+        sandesha2_seq_property_bean_free(create_seq_added, env);
     }
 
     soap_env = sandesha2_msg_ctx_get_soap_envelope(rm_msg_ctx, env);
@@ -1959,8 +1959,11 @@
 
             to_epr_bean = sandesha2_seq_property_bean_create_with_data(env, internal_sequence_id, 
                     SANDESHA2_SEQ_PROP_TO_EPR, to_str);
-
-            sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, to_epr_bean);
+            if(to_epr_bean)
+            {
+                sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, to_epr_bean);
+                sandesha2_seq_property_bean_free(to_epr_bean, env);
+            }
         }
     }
 

Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/msg_creator.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/msg_creator.c?rev=681094&r1=681093&r2=681094&view=diff
==============================================================================
--- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/msg_creator.c (original)
+++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/msg_creator.c Wed Jul 30 08:52:57 2008
@@ -129,6 +129,7 @@
 
     create_seq_msg_id = axutil_uuid_gen(env);
     axis2_msg_ctx_set_message_id(create_seq_msg_ctx, env, create_seq_msg_id);
+    AXIS2_FREE(env->allocator, create_seq_msg_id);
 
     app_msg_op_desc = axis2_msg_ctx_get_op(application_msg_ctx, env);
 
@@ -292,7 +293,12 @@
     sandesha2_msg_ctx_set_wsa_action(create_seq_rm_msg, env, temp_action);
 
     temp_soap_action = axutil_string_create(env, temp_action);
-    sandesha2_msg_ctx_set_soap_action(create_seq_rm_msg, env, temp_soap_action);
+    if(temp_soap_action)
+    {
+        sandesha2_msg_ctx_set_soap_action(create_seq_rm_msg, env, temp_soap_action);
+        axutil_string_free(temp_soap_action, env);
+    }
+
     /*sandesha2_msg_creator_finalize_creation(env, application_msg_ctx, create_seq_msg_ctx);*/
 
     return create_seq_rm_msg;

Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/seq_mgr.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/seq_mgr.c?rev=681094&r1=681093&r2=681094&view=diff
==============================================================================
--- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/seq_mgr.c (original)
+++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/util/seq_mgr.c Wed Jul 30 08:52:57 2008
@@ -196,6 +196,7 @@
     sandesha2_seq_property_bean_set_value(spec_version_bean, env, spec_version);
    
     sandesha2_seq_property_mgr_insert(seq_prop_mgr,env, spec_version_bean);
+    sandesha2_seq_property_bean_free(spec_version_bean, env);
     /* TODO Get the SOAP version from the creaet sequence message */
 
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[sandesha2]Entry:sandesha2_seq_mgr_setup_new_rmd_sequence");
@@ -389,6 +390,11 @@
             SANDESHA2_SEQ_PROP_ADDRESSING_NAMESPACE_VALUE, addr_ns_val);
 
     sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, addr_ns_bean);
+    if(addr_ns_bean)
+    {
+        sandesha2_seq_property_bean_free(addr_ns_bean, env);
+    }
+
     anon_uri = sandesha2_spec_specific_consts_get_anon_uri(env, addr_ns_val);
     
     to_epr = axis2_msg_ctx_get_to(first_app_msg, env);
@@ -403,6 +409,8 @@
         to_bean = sandesha2_seq_property_bean_create_with_data(env, internal_sequence_id, 
                 SANDESHA2_SEQ_PROP_TO_EPR, (axis2_char_t*)axis2_endpoint_ref_get_address(to_epr, 
                        env));
+        sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, to_bean);
+        sandesha2_seq_property_bean_free(to_bean, env);
     }
     
     is_svr_side = axis2_msg_ctx_get_server_side(first_app_msg, env);
@@ -430,6 +438,8 @@
             reply_to_bean = sandesha2_seq_property_bean_create_with_data(env, internal_sequence_id, 
                     SANDESHA2_SEQ_PROP_REPLY_TO_EPR, (axis2_char_t*)axis2_endpoint_ref_get_address(
                         reply_to_epr, env));
+            sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, reply_to_bean);
+            sandesha2_seq_property_bean_free(reply_to_bean, env);
         }
         else
         {
@@ -448,7 +458,8 @@
             reply_to_bean = sandesha2_seq_property_bean_create_with_data(env, internal_sequence_id, 
                     SANDESHA2_SEQ_PROP_REPLY_TO_EPR, (axis2_char_t*)axis2_endpoint_ref_get_address(
                         reply_to_epr, env));
-
+            sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, reply_to_bean);
+            sandesha2_seq_property_bean_free(reply_to_bean, env);
         } 
     }
 
@@ -462,23 +473,18 @@
 
     msgs_bean = sandesha2_seq_property_bean_create_with_data(env, internal_sequence_id, 
                         SANDESHA2_SEQ_PROP_CLIENT_COMPLETED_MESSAGES, "");
-
-    sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, msgs_bean);
-    if (to_bean)
+    if(msgs_bean)
     {
-        sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, to_bean);
+        sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, msgs_bean);
+        sandesha2_seq_property_bean_free(msgs_bean, env);
     }
     
     if(acks_to_bean)
     {
         sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, acks_to_bean);
+        sandesha2_seq_property_bean_free(acks_to_bean, env);
     }
 
-    if(reply_to_bean)
-    {
-        sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, reply_to_bean);
-    }   
-    
     transport_to = axis2_msg_ctx_get_transport_url(first_app_msg, env);
     
     if(transport_to)
@@ -492,8 +498,12 @@
 
     spec_version_bean = sandesha2_seq_property_bean_create_with_data(env, internal_sequence_id, 
             SANDESHA2_SEQ_PROP_RM_SPEC_VERSION, spec_version);
+    if(spec_version_bean)
+    {
+        sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, spec_version_bean);
+        sandesha2_seq_property_bean_free(spec_version_bean, env);
+    }
 
-    sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, spec_version_bean);
     sandesha2_seq_mgr_update_last_activated_time(env, internal_sequence_id, seq_prop_mgr);
 
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "Exit:sandesha2_seq_mgr_setup_new_rms_sequence");

Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/wsrm/create_seq.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/wsrm/create_seq.c?rev=681094&r1=681093&r2=681094&view=diff
==============================================================================
--- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/wsrm/create_seq.c (original)
+++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/wsrm/create_seq.c Wed Jul 30 08:52:57 2008
@@ -84,7 +84,7 @@
 }
 
 axis2_status_t AXIS2_CALL 
-sandesha2_create_seq_free (
+sandesha2_create_seq_free(
     sandesha2_create_seq_t *create_seq, 
     const axutil_env_t *env)
 {
@@ -100,8 +100,15 @@
     }
     create_seq->acks_to = NULL;
     create_seq->expires = NULL;
-    create_seq->seq_offer = NULL;
+
+    if(create_seq->seq_offer)
+    {
+        sandesha2_seq_offer_free(create_seq->seq_offer, env);
+        create_seq->seq_offer = NULL;
+    }
+
 	AXIS2_FREE(env->allocator, create_seq);
+
 	return AXIS2_SUCCESS;
 }
 

Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/wsrm/seq_offer.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/wsrm/seq_offer.c?rev=681094&r1=681093&r2=681094&view=diff
==============================================================================
--- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/wsrm/seq_offer.c (original)
+++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/wsrm/seq_offer.c Wed Jul 30 08:52:57 2008
@@ -73,7 +73,13 @@
         AXIS2_FREE(env->allocator, seq_offer->ns_val);
         seq_offer->ns_val = NULL;
     }
-    seq_offer->identifier = NULL;
+
+    if(seq_offer->identifier)
+    {
+        sandesha2_identifier_free(seq_offer->identifier, env);
+        seq_offer->identifier = NULL;
+    }
+
     seq_offer->expires = NULL;
 	AXIS2_FREE(env->allocator, seq_offer);
 	return AXIS2_SUCCESS;
@@ -210,13 +216,12 @@
     const axutil_env_t *env, 
     sandesha2_identifier_t *identifier)
 {
- 	if(NULL != seq_offer->identifier)
+ 	if(seq_offer->identifier)
 	{
-	/*
-		SANDESHA2_IDENTIFIER_FREE(seq_offer->identifier, env);
-		seq_offer->identifier = NULL;
-    */		
+		sandesha2_identifier_free(seq_offer->identifier, env);
+		seq_offer->identifier = NULL;	
 	}
+
 	seq_offer->identifier = identifier;
  	return AXIS2_SUCCESS;
 }

Modified: webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/wsrm/sequence.c
URL: http://svn.apache.org/viewvc/webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/wsrm/sequence.c?rev=681094&r1=681093&r2=681094&view=diff
==============================================================================
--- webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/wsrm/sequence.c (original)
+++ webservices/sandesha/tags/sandesha2/c/worker_thread_removed-23may2008/src/wsrm/sequence.c Wed Jul 30 08:52:57 2008
@@ -295,22 +295,26 @@
 {
 	axiom_soap_header_t *soap_header = NULL;
     axutil_qname_t *seq_qname = NULL;
+
     AXIS2_PARAM_CHECK(env->error, envelope, AXIS2_FAILURE);
     soap_header = axiom_soap_envelope_get_header(envelope, env);
+
     /**
      * Remove if old exists
      */
-    seq_qname = axutil_qname_create(env, SANDESHA2_WSRM_COMMON_SEQ, 
-        seq->ns_val, NULL);
+    seq_qname = axutil_qname_create(env, SANDESHA2_WSRM_COMMON_SEQ, seq->ns_val, NULL);
     if(!seq_qname)
     {
         return AXIS2_FAILURE;
     }
     axiom_soap_header_remove_header_block(soap_header, env, seq_qname);
-    sandesha2_seq_to_om_node((sandesha2_seq_t*)seq, env, 
-        soap_header);
+
+    sandesha2_seq_to_om_node((sandesha2_seq_t*)seq, env, soap_header);
     if(seq_qname)
+    {
         axutil_qname_free(seq_qname, env);
+    }
+
 	return AXIS2_SUCCESS;
 }
 



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