Author: damitha
Date: Tue Jan 29 00:34:43 2008
New Revision: 616205

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

Modified:
    webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c
    
webservices/sandesha/trunk/c/src/msgprocessors/create_seq_res_msg_processor.c
    
webservices/sandesha/trunk/c/src/msgprocessors/terminate_seq_res_msg_processor.c
    webservices/sandesha/trunk/c/src/polling/polling_mgr.c
    webservices/sandesha/trunk/c/src/storage/sqlite/permanent_storage_mgr.c
    webservices/sandesha/trunk/c/src/util/sandesha2_utils.c
    webservices/sandesha/trunk/c/src/util/terminate_mgr.c
    webservices/sandesha/trunk/c/src/workers/sender_worker.c

Modified: webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c?rev=616205&r1=616204&r2=616205&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c 
(original)
+++ webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c Tue Jan 
29 00:34:43 2008
@@ -1500,10 +1500,12 @@
     }
     create_seq_msg = sandesha2_msg_ctx_get_msg_ctx(create_seq_rm_msg, env);
     axis2_msg_ctx_set_relates_to(create_seq_msg, env, NULL);
+    str_key = axutil_uuid_gen(env);
     create_seq_bean = sandesha2_create_seq_bean_create_with_data(env, 
         internal_seq_id, (axis2_char_t*)axis2_msg_ctx_get_wsa_message_id(
         create_seq_msg, env), NULL);
-
+    sandesha2_create_seq_bean_set_ref_msg_store_key(create_seq_bean, env, 
+        str_key);
     temp_opctx = axis2_msg_ctx_get_op_ctx(create_seq_msg, env);
     /*axis2_op_ctx_increment_ref(temp_opctx, env);*/
     sandesha2_create_seq_mgr_insert(create_seq_mgr, env, create_seq_bean);
@@ -1518,7 +1520,6 @@
         cs_epr = axis2_endpoint_ref_create(env, anon_uri);
         axis2_msg_ctx_set_reply_to(create_seq_msg, env, cs_epr);
     }
-    str_key = axutil_uuid_gen(env);
     create_seq_entry = sandesha2_sender_bean_create(env);
     sandesha2_sender_bean_set_msg_ctx_ref_key(create_seq_entry, env, str_key);
     millisecs = sandesha2_utils_get_current_time_in_millis(env);

Modified: 
webservices/sandesha/trunk/c/src/msgprocessors/create_seq_res_msg_processor.c
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/msgprocessors/create_seq_res_msg_processor.c?rev=616205&r1=616204&r2=616205&view=diff
==============================================================================
--- 
webservices/sandesha/trunk/c/src/msgprocessors/create_seq_res_msg_processor.c 
(original)
+++ 
webservices/sandesha/trunk/c/src/msgprocessors/create_seq_res_msg_processor.c 
Tue Jan 29 00:34:43 2008
@@ -425,6 +425,9 @@
             axis2_msg_ctx_set_to(create_seq_msg, env, to);
             axis2_msg_ctx_set_relates_to(create_seq_msg, env, NULL);
             new_msg_store_key = axutil_uuid_gen(env);
+            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
+                "[sandesha2]Storing msg_ctx with msg_id:%s", 
+                axis2_msg_ctx_get_msg_id(create_seq_msg, env));
             sandesha2_storage_mgr_store_msg_ctx(storage_mgr, env, 
new_msg_store_key, 
                 create_seq_msg);
             if(create_seq_rm_msg)
@@ -557,6 +560,8 @@
     op_ctx = axis2_msg_ctx_get_op_ctx(msg_ctx, env);
     axis2_op_ctx_set_response_written(op_ctx, env, AXIS2_TRUE);
     sandesha2_msg_ctx_set_paused(rm_msg_ctx, env, AXIS2_TRUE);
+    /*if(op_ctx)
+        axis2_op_ctx_free(op_ctx, env);*/
     if(seq_prop_mgr)
         sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
     if(create_seq_mgr)

Modified: 
webservices/sandesha/trunk/c/src/msgprocessors/terminate_seq_res_msg_processor.c
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/msgprocessors/terminate_seq_res_msg_processor.c?rev=616205&r1=616204&r2=616205&view=diff
==============================================================================
--- 
webservices/sandesha/trunk/c/src/msgprocessors/terminate_seq_res_msg_processor.c
 (original)
+++ 
webservices/sandesha/trunk/c/src/msgprocessors/terminate_seq_res_msg_processor.c
 Tue Jan 29 00:34:43 2008
@@ -27,6 +27,7 @@
 #include <axis2_conf_ctx.h>
 #include <sandesha2_utils.h>
 #include <sandesha2_terminate_mgr.h>
+#include <sandesha2_polling_mgr.h>
 
 /** 
  * @brief Terminate Sequence Response Message Processor struct impl
@@ -138,9 +139,7 @@
     AXIS2_PARAM_CHECK(env->error, rm_msg_ctx, AXIS2_FAILURE);
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "[sandesha2]Entry:sandesha2_"\
         "terminate_seq_res_msg_processor_process_in_msg");
-    
     msg_ctx = sandesha2_msg_ctx_get_msg_ctx(rm_msg_ctx, env);
-    
     term_seq_res = sandesha2_msg_ctx_get_terminate_seq_res(rm_msg_ctx, env);
     if(!term_seq_res)
     {

Modified: webservices/sandesha/trunk/c/src/polling/polling_mgr.c
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/polling/polling_mgr.c?rev=616205&r1=616204&r2=616205&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/polling/polling_mgr.c (original)
+++ webservices/sandesha/trunk/c/src/polling/polling_mgr.c Tue Jan 29 00:34:43 
2008
@@ -83,7 +83,6 @@
     const axutil_env_t *env)
 {
     sandesha2_polling_mgr_t *polling_mgr = NULL;
-    AXIS2_ENV_CHECK(env, NULL);
     
     polling_mgr =  (sandesha2_polling_mgr_t *)AXIS2_MALLOC 
         (env->allocator, 
@@ -108,7 +107,6 @@
     const axutil_env_t *env)
 {
     sandesha2_polling_mgr_t *polling_mgr_l = NULL;
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
 
     polling_mgr_l = (sandesha2_polling_mgr_t *) polling_mgr;
     return sandesha2_polling_mgr_free(polling_mgr_l, env);
@@ -119,7 +117,6 @@
     sandesha2_polling_mgr_t *polling_mgr, 
     const axutil_env_t *env)
 {
-       AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     /* Do not free this */
     polling_mgr->conf_ctx = NULL;
     
@@ -142,8 +139,6 @@
     sandesha2_polling_mgr_t *polling_mgr,
     const axutil_env_t *env)
 {
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    
     sandesha2_polling_mgr_set_poll(polling_mgr, env, AXIS2_FALSE);
     return AXIS2_SUCCESS;
 }

Modified: 
webservices/sandesha/trunk/c/src/storage/sqlite/permanent_storage_mgr.c
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/storage/sqlite/permanent_storage_mgr.c?rev=616205&r1=616204&r2=616205&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/storage/sqlite/permanent_storage_mgr.c 
(original)
+++ webservices/sandesha/trunk/c/src/storage/sqlite/permanent_storage_mgr.c Tue 
Jan 29 00:34:43 2008
@@ -341,28 +341,37 @@
 
                 axutil_hash_this(i, &k, NULL, &v);
                 key_l = (axis2_char_t *) k;
+                AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "key:%s", key);
+                AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "key_l:%s", key_l);
                 if(0 == axutil_strcmp(key, key_l))
                 {
                     axis2_op_ctx_t *op_ctx = NULL;
                     msg_ctx = (axis2_msg_ctx_t *) v;
                     op_ctx = 
                         axis2_msg_ctx_get_op_ctx(msg_ctx, env);
-                    axis2_op_ctx_set_in_use(op_ctx, env, AXIS2_FALSE);
-                    axutil_hash_set(msg_ctx_map, key, AXIS2_HASH_KEY_STRING, 
-                        NULL);
-                    AXIS2_FREE(env->allocator, key_l);
                     if(msg_type == SANDESHA2_MSG_TYPE_APPLICATION)
                     {
                         axiom_soap_envelope_t *soap_envelope = 
                             axis2_msg_ctx_get_soap_envelope(msg_ctx, env);
+                        axis2_op_ctx_set_in_use(op_ctx, env, AXIS2_FALSE);
                         axiom_soap_envelope_free(soap_envelope, env);
                         axis2_op_ctx_free(op_ctx, env);
+                        axutil_hash_set(msg_ctx_map, key, 
AXIS2_HASH_KEY_STRING, 
+                            NULL);
+                        AXIS2_FREE(env->allocator, key_l);
                     }
                     else if(msg_type != SANDESHA2_MSG_TYPE_CREATE_SEQ)
                     {
+                        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, 
+                            "[sandesha2]Removing msg_ctx with msg_id:%s", 
+                            axis2_msg_ctx_get_msg_id(msg_ctx, env));
+                        axis2_op_ctx_set_in_use(op_ctx, env, AXIS2_FALSE);
                         axis2_msg_ctx_set_keep_alive(msg_ctx, env, 
AXIS2_FALSE);
                         axis2_msg_ctx_set_paused(msg_ctx, env, AXIS2_FALSE);
                         axis2_op_ctx_free(op_ctx, env);
+                        axutil_hash_set(msg_ctx_map, key, 
AXIS2_HASH_KEY_STRING, 
+                            NULL);
+                        AXIS2_FREE(env->allocator, key_l);
                     }
                 }
             }
@@ -631,8 +640,8 @@
                 axis2_msg_ctx_set_property(msg_ctx, env, key, property);
             }
     }
-    if(msg_store_bean)
-        sandesha2_msg_store_bean_free(msg_store_bean, env);
+    /*if(msg_store_bean)
+        sandesha2_msg_store_bean_free(msg_store_bean, env);*/
     return msg_ctx;
 }
 

Modified: webservices/sandesha/trunk/c/src/util/sandesha2_utils.c
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/util/sandesha2_utils.c?rev=616205&r1=616204&r2=616205&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/util/sandesha2_utils.c (original)
+++ webservices/sandesha/trunk/c/src/util/sandesha2_utils.c Tue Jan 29 00:34:43 
2008
@@ -671,6 +671,7 @@
     
     out_stream = axis2_msg_ctx_get_transport_out_stream(ref_msg, 
         env);
+    /*out_stream = axutil_stream_create_basic(env);*/
     axis2_msg_ctx_set_transport_out_stream(new_msg, env, out_stream);
     property = axis2_msg_ctx_get_property(ref_msg, env, 
         AXIS2_TRANSPORT_IN);
@@ -689,8 +690,8 @@
     if(property)
         axis2_msg_ctx_set_property(new_msg, env, AXIS2_TRANSPORT_HEADERS, 
             axutil_property_clone(property, env));
-    axis2_msg_ctx_set_execution_chain(new_msg, env, 
-        axis2_msg_ctx_get_execution_chain(ref_msg, env));
+    /*axis2_msg_ctx_set_execution_chain(new_msg, env, 
+        axis2_msg_ctx_get_execution_chain(ref_msg, env));*/
     paused_phase_name = (axis2_char_t*)axis2_msg_ctx_get_paused_phase_name(
         ref_msg, env);
     axis2_msg_ctx_set_paused_phase_name(new_msg, env, paused_phase_name);

Modified: webservices/sandesha/trunk/c/src/util/terminate_mgr.c
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/util/terminate_mgr.c?rev=616205&r1=616204&r2=616205&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/util/terminate_mgr.c (original)
+++ webservices/sandesha/trunk/c/src/util/terminate_mgr.c Tue Jan 29 00:34:43 
2008
@@ -598,6 +598,7 @@
             create_seq_bean = axutil_array_list_get(found_list, env, i);
             key = sandesha2_create_seq_bean_get_ref_msg_store_key(
                 create_seq_bean, env);
+            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "[sandesha2] dam_key:%s", 
key);
             if(key) 
                sandesha2_storage_mgr_remove_msg_ctx(storage_mgr, env, key, 
                    conf_ctx, -1);

Modified: webservices/sandesha/trunk/c/src/workers/sender_worker.c
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/workers/sender_worker.c?rev=616205&r1=616204&r2=616205&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/workers/sender_worker.c (original)
+++ webservices/sandesha/trunk/c/src/workers/sender_worker.c Tue Jan 29 
00:34:43 2008
@@ -327,6 +327,7 @@
     {
         /* This is neccessary to avoid a double free */
         axis2_msg_ctx_set_property(msg_ctx, env, AXIS2_TRANSPORT_IN, NULL);
+        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "dam_msg_id:%s", msg_id);
         if(AXIS2_TRANSPORT_SENDER_INVOKE(transport_sender, env, msg_ctx))
                {
                successfully_sent = AXIS2_TRUE;



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to