Author: damitha
Date: Mon Jan  7 07:39:10 2008
New Revision: 609640

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


Modified:
    webservices/sandesha/trunk/c/src/msgprocessors/ack_msg_processor.c
    webservices/sandesha/trunk/c/src/storage/sqlite/permanent_sender_mgr.c
    webservices/sandesha/trunk/c/src/util/sandesha2_utils.c
    webservices/sandesha/trunk/c/src/wsrm/identifier.c

Modified: webservices/sandesha/trunk/c/src/msgprocessors/ack_msg_processor.c
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/msgprocessors/ack_msg_processor.c?rev=609640&r1=609639&r2=609640&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/msgprocessors/ack_msg_processor.c 
(original)
+++ webservices/sandesha/trunk/c/src/msgprocessors/ack_msg_processor.c Mon Jan  
7 07:39:10 2008
@@ -362,6 +362,8 @@
     }
     if(str_list)
         AXIS2_FREE(env->allocator, str_list);
+    if(completed_bean)
+        sandesha2_seq_property_bean_free(completed_bean, env);
     last_out_msg_no_str = sandesha2_utils_get_seq_property(env, int_seq_id,
         SANDESHA2_SEQ_PROP_LAST_OUT_MESSAGE_NO, seq_prop_mgr);
     if(last_out_msg_no_str)

Modified: webservices/sandesha/trunk/c/src/storage/sqlite/permanent_sender_mgr.c
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/storage/sqlite/permanent_sender_mgr.c?rev=609640&r1=609639&r2=609640&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/storage/sqlite/permanent_sender_mgr.c 
(original)
+++ webservices/sandesha/trunk/c/src/storage/sqlite/permanent_sender_mgr.c Mon 
Jan  7 07:39:10 2008
@@ -687,12 +687,13 @@
     const axis2_char_t *seq_id)
 {
     int i = 0;
-    int size = 0;
+    /*int size = 0;*/
     int match_list_size = 0;
-    axutil_array_list_t *match_list = axutil_array_list_create(env, 0);
-    axutil_array_list_t *find_list = NULL;
+    axutil_array_list_t *match_list = NULL;
+    /*axutil_array_list_t *match_list = axutil_array_list_create(env, 0);
+    axutil_array_list_t *find_list = NULL;*/
     axis2_char_t sql_find[1024];
-    sandesha2_sender_bean_t *matcher = sandesha2_sender_bean_create(env);
+    /*sandesha2_sender_bean_t *matcher = sandesha2_sender_bean_create(env);*/
     long time_now = 0;
     sandesha2_permanent_sender_mgr_t *sender_mgr_impl = NULL;
     sandesha2_sender_bean_t *result = NULL;
@@ -700,18 +701,29 @@
         "permanent_sender_mgr_get_next_msg_to_send");
     sender_mgr_impl = SANDESHA2_INTF_TO_IMPL(sender_mgr);
 
-    sandesha2_sender_bean_set_send(matcher, env, AXIS2_TRUE);
+    /*sandesha2_sender_bean_set_send(matcher, env, AXIS2_TRUE);
     time_now = sandesha2_utils_get_current_time_in_millis(env);
     sandesha2_sender_bean_set_time_to_send(matcher, env, time_now);
     sandesha2_sender_bean_set_internal_seq_id(matcher, env, 
-        (axis2_char_t *) seq_id);
+        (axis2_char_t *) seq_id);*/
     
     sprintf(sql_find, "select msg_id, msg_ctx_ref_key, "\
         "internal_seq_id, sent_count, msg_no, send, resend, "\
         "time_to_send, msg_type, seq_id, wsrm_anon_uri, "\
-        "to_address from sender;");
-     
-    find_list = sandesha2_permanent_bean_mgr_find(sender_mgr_impl->bean_mgr, 
+        "to_address from sender where ");
+    time_now = sandesha2_utils_get_current_time_in_millis(env);
+    if(time_now > 0)
+        sprintf(sql_find + axutil_strlen(sql_find), "time_to_send <= %ld ", 
+            time_now);
+    if(seq_id)
+        sprintf(sql_find + axutil_strlen(sql_find), "and 
internal_seq_id='%s'", 
+            seq_id);
+    sprintf(sql_find + axutil_strlen(sql_find), " and send=%d", AXIS2_TRUE);
+    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "sql_find:%s", sql_find);  
+    match_list = sandesha2_permanent_bean_mgr_find(sender_mgr_impl->bean_mgr, 
+        env, sandesha2_sender_find_callback, sql_find);
+    match_list_size = axutil_array_list_size(match_list, env);
+    /*find_list = sandesha2_permanent_bean_mgr_find(sender_mgr_impl->bean_mgr, 
         env, sandesha2_sender_find_callback, sql_find);
     if(find_list)
         size = axutil_array_list_size(find_list, env);
@@ -732,7 +744,7 @@
     if(find_list)
         axutil_array_list_free(find_list, env);
     if(matcher)
-        sandesha2_sender_bean_free(matcher, env);
+        sandesha2_sender_bean_free(matcher, env);*/
 
     /*
      * We either return an application message or an RM message. If we find

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=609640&r1=609639&r2=609640&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/util/sandesha2_utils.c (original)
+++ webservices/sandesha/trunk/c/src/util/sandesha2_utils.c Mon Jan  7 07:39:10 
2008
@@ -316,12 +316,11 @@
         axutil_array_list_t *list, 
         int type)
 {
-    axis2_char_t *list_str = NULL;
+    axis2_char_t *list_str = AXIS2_MALLOC(env->allocator, 
+        1024 * sizeof(axis2_char_t));
     int i = 0, size = 0;
     
     AXIS2_PARAM_CHECK(env->error, list, NULL);
-    
-    list_str = axutil_strdup(env, "[");
     size = axutil_array_list_size(list, env);
     for(i = 0; i < size; i++)
     {
@@ -329,22 +328,20 @@
         {
             axis2_char_t *element = axutil_array_list_get(list, env, i);
             if(0 == i)
-                list_str = axutil_strcat(env, list_str, element, NULL);
-            list_str = axutil_strcat(env, list_str, ",", element, NULL);
+                sprintf(list_str, "[%s", element);
+            sprintf(list_str + axutil_strlen(list_str), ",%s", element);
         }
         else if(SANDESHA2_ARRAY_LIST_LONG == type)
         {
             long *element = axutil_array_list_get(list, env, i);
-            axis2_char_t value[32];
-            sprintf(value, "%ld", *element);
             if(0 == i)
-                list_str = axutil_strcat(env, list_str, value, NULL);
-            list_str = axutil_strcat(env, list_str, ",", value, NULL);
+                sprintf(list_str, "[%ld", *element);
+            sprintf(list_str + axutil_strlen(list_str), ",%ld", *element);
         } 
     }
-    list_str = axutil_strcat(env, list_str, "]", NULL);
-    
+    sprintf(list_str + axutil_strlen(list_str), "]");
     return list_str;
+
 }
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL                        

Modified: webservices/sandesha/trunk/c/src/wsrm/identifier.c
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/wsrm/identifier.c?rev=609640&r1=609639&r2=609640&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/wsrm/identifier.c (original)
+++ webservices/sandesha/trunk/c/src/wsrm/identifier.c Mon Jan  7 07:39:10 2008
@@ -189,6 +189,8 @@
     }
     ident_part = axiom_element_get_first_child_with_qname(om_element, env,
                         ident_qname, om_node, &ident_node);
+    if(ident_qname)
+        axutil_qname_free(ident_qname, env);
     if(NULL == ident_part)
     {
         AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_NULL_OM_ELEMENT,



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

Reply via email to