Author: damitha
Date: Sun Jan 27 05:57:59 2008
New Revision: 615602
URL: http://svn.apache.org/viewvc?rev=615602&view=rev
Log:
Fixing memory leaks
Modified:
webservices/sandesha/trunk/c/samples/rm_echo_single_1_0/rm_echo_single.c
webservices/sandesha/trunk/c/samples/rm_ping_1_0/rm_ping_1_0.c
webservices/sandesha/trunk/c/src/handlers/sandesha2_out_handler.c
webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c
webservices/sandesha/trunk/c/src/storage/sqlite/permanent_storage_mgr.c
webservices/sandesha/trunk/c/src/transport/sandesha2_transport_sender.c
webservices/sandesha/trunk/c/src/util/ack_mgr.c
webservices/sandesha/trunk/c/src/util/sandesha2_utils.c
webservices/sandesha/trunk/c/src/util/terminate_mgr.c
Modified:
webservices/sandesha/trunk/c/samples/rm_echo_single_1_0/rm_echo_single.c
URL:
http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/rm_echo_single_1_0/rm_echo_single.c?rev=615602&r1=615601&r2=615602&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/samples/rm_echo_single_1_0/rm_echo_single.c
(original)
+++ webservices/sandesha/trunk/c/samples/rm_echo_single_1_0/rm_echo_single.c
Sun Jan 27 05:57:59 2008
@@ -281,9 +281,9 @@
if(!ret_node)
{
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
- "Stub invoke FAILED: Error code:%d :: %s",
- env->error->error_number,
- AXIS2_ERROR_GET_MESSAGE(env->error));
+ "Stub invoke FAILED: Error code:%d :: %s",
+ env->error->error_number,
+ AXIS2_ERROR_GET_MESSAGE(env->error));
printf("echo stub invoke FAILED!\n");
status = AXIS2_FAILURE;
}
@@ -292,7 +292,10 @@
axis2_char_t *om_str = NULL;
om_str = axiom_node_to_string(ret_node, env);
if (om_str)
+ {
printf("\nReceived OM : %s\n", om_str);
+ AXIS2_FREE(env->allocator, om_str);
+ }
printf("\necho client invoke SUCCESSFUL!\n");
}
}
Modified: webservices/sandesha/trunk/c/samples/rm_ping_1_0/rm_ping_1_0.c
URL:
http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/rm_ping_1_0/rm_ping_1_0.c?rev=615602&r1=615601&r2=615602&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/samples/rm_ping_1_0/rm_ping_1_0.c (original)
+++ webservices/sandesha/trunk/c/samples/rm_ping_1_0/rm_ping_1_0.c Sun Jan 27
05:57:59 2008
@@ -197,8 +197,11 @@
axiom_element_set_text(text_om_ele, env, seq, seq_om_node);
buffer = axiom_node_to_string(ping_om_node, env);
- printf("\nSending OM node in XML : %s \n", buffer);
-
+ if(buffer)
+ {
+ printf("\nSending OM node in XML : %s \n", buffer);
+ AXIS2_FREE(env->allocator, buffer);
+ }
return ping_om_node;
}
Modified: webservices/sandesha/trunk/c/src/handlers/sandesha2_out_handler.c
URL:
http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/handlers/sandesha2_out_handler.c?rev=615602&r1=615601&r2=615602&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/handlers/sandesha2_out_handler.c (original)
+++ webservices/sandesha/trunk/c/src/handlers/sandesha2_out_handler.c Sun Jan
27 05:57:59 2008
@@ -112,43 +112,6 @@
}
if(module_qname)
axutil_qname_free(module_qname, env);
- if(!axis2_msg_ctx_get_server_side(msg_ctx, env))
- {
- axis2_ctx_t *conf_ctx_base = axis2_conf_ctx_get_base(conf_ctx, env);
- axutil_property_t *property = axutil_property_create_with_args(env, 0,
- 0, 0, NULL);
- axis2_ctx_set_property(conf_ctx_base, env, SANDESHA2_IS_SVR_SIDE,
- property);
- }
- else
- {
- /*int size = -1, i = 0;
- axis2_bool_t found = AXIS2_FALSE;
- axutil_array_list_t *mod_qnames = NULL;
- axutil_qname_t *mod_qname = axutil_qname_create(env, SANDESHA2_MODULE,
- NULL, NULL);
- mod_qnames = (axutil_array_list_t
*)axis2_svc_get_all_module_qnames(svc,
- env);
- size = axutil_array_list_size(mod_qnames, env);
-
- for (i = 0; i < size; i++)
- {
- axutil_qname_t *qname = NULL;
- qname = axutil_array_list_get(mod_qnames, env, i);
- if (qname)
- {
- found = axutil_qname_equals(mod_qname, env, qname);
- if (found)
- break;
- }
- }
- if (!found)
- {
- AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
- "[sandesha2]RM is not engaged. So return here.");
- return AXIS2_SUCCESS;
- }*/
- }
temp_prop = axis2_msg_ctx_get_property(msg_ctx, env,
SANDESHA2_APPLICATION_PROCESSING_DONE);
if(temp_prop)
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=615602&r1=615601&r2=615602&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c
(original)
+++ webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c Sun Jan
27 05:57:59 2008
@@ -203,7 +203,6 @@
sandesha2_seq_property_bean_t *msgs_bean = NULL;
long msg_no = 0;
long highest_in_msg_no = 0;
- axis2_char_t *str_key = NULL;
axis2_char_t *msgs_str = "";
axis2_char_t msg_num_str[32];
sandesha2_invoker_mgr_t *invoker_mgr = NULL;
@@ -428,7 +427,6 @@
sandesha2_storage_mgr_free(storage_mgr, env);
return AXIS2_FAILURE;
}
- str_key = axutil_uuid_gen(env);
highest_in_msg_no_str = sandesha2_utils_get_seq_property(env, str_seq_id,
SANDESHA2_SEQ_PROP_HIGHEST_IN_MSG_NUMBER, seq_prop_mgr);
highest_in_msg_key_str = sandesha2_utils_get_seq_property(env, str_seq_id,
@@ -627,6 +625,7 @@
axutil_array_list_t *incoming_seq_list = NULL;
axis2_char_t *str_value = NULL;
axutil_property_t *property = NULL;
+ axis2_char_t *str_key = NULL;
incoming_seq_list_bean = sandesha2_seq_property_mgr_retrieve(
seq_prop_mgr, env, SANDESHA2_SEQ_PROP_ALL_SEQS,
@@ -688,11 +687,13 @@
incoming_seq_list_bean);
}
/* save the message */
+ str_key = axutil_uuid_gen(env);
sandesha2_storage_mgr_store_msg_ctx(storage_mgr, env, str_key,
msg_ctx);
-
invoker_bean = sandesha2_invoker_bean_create_with_data(env, str_key,
msg_no, str_seq_id, AXIS2_FALSE);
+ if(str_key)
+ AXIS2_FREE(env->allocator, str_key);
sandesha2_invoker_mgr_insert(invoker_mgr, env, invoker_bean);
property = axutil_property_create_with_args(env, 0, 0, 0,
AXIS2_VALUE_TRUE);
@@ -886,7 +887,6 @@
if(!axis2_msg_ctx_get_msg_id(msg_ctx, env))
axis2_msg_ctx_set_message_id(msg_ctx, env, axutil_uuid_gen(env));
- storage_key = axutil_uuid_gen(env);
if(is_svr_side)
{
sandesha2_seq_t *req_seq = NULL;
@@ -1013,6 +1013,8 @@
"[sandesha2]Invalid message number");
AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_INVALID_MSG_NUM,
AXIS2_FAILURE);
+ if(internal_seq_id)
+ AXIS2_FREE(env->allocator, internal_seq_id);
if(seq_prop_mgr)
sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
if(create_seq_mgr)
@@ -1032,6 +1034,8 @@
"[sandesha2] Invalid Message Number");
AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_INVALID_MSG_NUM,
AXIS2_FAILURE);
+ if(internal_seq_id)
+ AXIS2_FREE(env->allocator, internal_seq_id);
if(seq_prop_mgr)
sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
if(create_seq_mgr)
@@ -1066,6 +1070,8 @@
internal_seq_id, SANDESHA2_SEQ_PROP_HIGHEST_OUT_MSG_NUMBER,
msg_number_str);
sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, res_highest_msg_bean);
+ if(res_highest_msg_bean)
+ sandesha2_seq_property_bean_free(res_highest_msg_bean, env);
relates_to = axis2_msg_ctx_get_relates_to(msg_ctx, env);
if(relates_to)
{
@@ -1078,6 +1084,7 @@
sandesha2_seq_property_mgr_insert(seq_prop_mgr, env,
response_relates_to_bean);
}
+ storage_key = axutil_uuid_gen(env);
if(last_msg)
{
sandesha2_seq_property_bean_t *res_highest_msg_key_bean = NULL;
@@ -1137,6 +1144,8 @@
"[sandesha2] Invalid spec version");
AXIS2_ERROR_SET(env->error, SANDESHA2_ERROR_INVALID_SPEC_VERSION,
AXIS2_FAILURE);
+ if(internal_seq_id)
+ AXIS2_FREE(env->allocator, internal_seq_id);
if(seq_prop_mgr)
sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
if(create_seq_mgr)
@@ -1186,7 +1195,7 @@
"[sandesha2]msg_ctx_map not found in the conf_ctx");
msg_ctx_map = axutil_hash_make(env);
property = axutil_property_create_with_args(env,
AXIS2_SCOPE_APPLICATION,
- AXIS2_FALSE, 0, msg_ctx_map);
+ AXIS2_TRUE, axutil_hash_free_void_arg, msg_ctx_map);
axis2_ctx_set_property(ctx, env, SANDESHA2_MSG_CTX_MAP,
property);
}
@@ -1315,7 +1324,9 @@
sandesha2_app_msg_processor_process_response_msg(env, rm_msg_ctx,
internal_seq_id, out_seq_id, msg_number, storage_key, storage_mgr,
seq_prop_mgr, sender_mgr);
- axis2_msg_ctx_set_paused(msg_ctx, env, AXIS2_TRUE);
+ axis2_msg_ctx_set_paused(msg_ctx, env, AXIS2_TRUE);
+ if(internal_seq_id)
+ AXIS2_FREE(env->allocator, internal_seq_id);
if(seq_prop_mgr)
sandesha2_seq_property_mgr_free(seq_prop_mgr, env);
if(create_seq_mgr)
@@ -1522,7 +1533,7 @@
SANDESHA2_MSG_TYPE_CREATE_SEQ);
sandesha2_sender_mgr_insert(sender_mgr, env, create_seq_entry);
sandesha2_storage_mgr_store_msg_ctx(storage_mgr, env, str_key,
create_seq_msg);
- property = axutil_property_create_with_args(env, 0, 0, 0, str_key);
+ property = axutil_property_create_with_args(env, 0, AXIS2_TRUE, 0,
str_key);
axis2_msg_ctx_set_property(create_seq_msg, env,
SANDESHA2_MESSAGE_STORE_KEY,
property);
orig_trans_out = axis2_msg_ctx_get_transport_out_desc(create_seq_msg, env);
@@ -1586,6 +1597,7 @@
axis2_char_t *msg_id = NULL;
axis2_bool_t last_msg = AXIS2_FALSE;
axis2_op_ctx_t *temp_op_ctx = NULL;
+ axis2_status_t status = AXIS2_FAILURE;
AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
"[Sandesha2] sandesha2_app_msg_processor_process_response_msg");
@@ -1607,12 +1619,14 @@
{
to_epr = axis2_endpoint_ref_create(env,
sandesha2_seq_property_bean_get_value(to_bean, env));
+ sandesha2_seq_property_bean_free(to_bean, env);
}
if(reply_to_bean)
{
reply_to_epr = axis2_endpoint_ref_create(env,
sandesha2_seq_property_bean_get_value(reply_to_bean, env));
+ sandesha2_seq_property_bean_free(reply_to_bean, env);
}
if (to_epr)
@@ -1808,7 +1822,7 @@
{
axis2_transport_out_desc_t *trans_out = NULL;
- property = axutil_property_create_with_args(env, 0, 0, 0, storage_key);
+ property = axutil_property_create_with_args(env, 0, AXIS2_TRUE, 0,
storage_key);
axis2_msg_ctx_set_property(app_msg_ctx, env,
SANDESHA2_MESSAGE_STORE_KEY, property);
@@ -1824,9 +1838,12 @@
axis2_msg_ctx_get_current_handler_index(app_msg_ctx, env) + 1);
engine = axis2_engine_create(env, axis2_msg_ctx_get_conf_ctx(app_msg_ctx,
env));
+ status = axis2_engine_resume_send(engine, env, app_msg_ctx);
+ if(engine)
+ axis2_engine_free(engine, env);
AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
"[Sandesha2] Exit:sandesha2_app_msg_processor_process_response_msg");
- return axis2_engine_resume_send(engine, env, app_msg_ctx);
+ return status;
}
@@ -1853,6 +1870,7 @@
{
next_msg_no = atol(str_value);
}
+ sandesha2_seq_property_bean_free(next_msg_no_bean, env);
}
return next_msg_no;
}
@@ -1902,6 +1920,8 @@
{
sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, next_msg_no_bean);
}
+ if(next_msg_no_bean)
+ sandesha2_seq_property_bean_free(next_msg_no_bean, env);
AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
"[sandesha2] Exit:sandesha2_app_msg_processor_set_next_msg_no");
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=615602&r1=615601&r2=615602&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 Sun
Jan 27 05:57:59 2008
@@ -293,8 +293,8 @@
msg_ctx_map = axutil_property_get_value(property, env);
if(msg_ctx_map)
{
- axutil_hash_set(msg_ctx_map, key, AXIS2_HASH_KEY_STRING,
- msg_ctx);
+ axutil_hash_set(msg_ctx_map, axutil_strdup(env, key),
+ AXIS2_HASH_KEY_STRING, msg_ctx);
}
}
}
Modified:
webservices/sandesha/trunk/c/src/transport/sandesha2_transport_sender.c
URL:
http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/transport/sandesha2_transport_sender.c?rev=615602&r1=615601&r2=615602&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/transport/sandesha2_transport_sender.c
(original)
+++ webservices/sandesha/trunk/c/src/transport/sandesha2_transport_sender.c Sun
Jan 27 05:57:59 2008
@@ -191,10 +191,6 @@
sandesha2_storage_mgr_update_msg_ctx(storage_mgr, env, key, msg_ctx);
if(storage_mgr)
sandesha2_storage_mgr_free(storage_mgr, env);
- /*if(msg_ctx)
- {
- axis2_msg_ctx_free(msg_ctx, env);
- }*/
AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI,
"[sandesha2]Exit:sandesha2_transport_sender_invoke");
return AXIS2_SUCCESS;
Modified: webservices/sandesha/trunk/c/src/util/ack_mgr.c
URL:
http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/src/util/ack_mgr.c?rev=615602&r1=615601&r2=615602&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/util/ack_mgr.c (original)
+++ webservices/sandesha/trunk/c/src/util/ack_mgr.c Sun Jan 27 05:57:59 2008
@@ -63,9 +63,12 @@
acks_to_bean = sandesha2_seq_property_mgr_retrieve(seq_prop_mgr, env,
seq_id, SANDESHA2_SEQ_PROP_ACKS_TO_EPR);
if(acks_to_bean)
+ {
acks_to = axis2_endpoint_ref_create(env,
sandesha2_seq_property_bean_get_value(acks_to_bean,
env));
+ sandesha2_seq_property_bean_free(acks_to_bean, env);
+ }
if(acks_to)
acks_to_str = (axis2_char_t*)axis2_endpoint_ref_get_address(acks_to,
env);
if(!acks_to_str)
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=615602&r1=615601&r2=615602&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/util/sandesha2_utils.c (original)
+++ webservices/sandesha/trunk/c/src/util/sandesha2_utils.c Sun Jan 27 05:57:59
2008
@@ -1126,7 +1126,7 @@
SANDESHA2_MSG_TYPE_CREATE_SEQ);
/* Message will be stored in the sandesha2_transport_sender */
property = axutil_property_create_with_args(env, AXIS2_SCOPE_REQUEST,
- AXIS2_FALSE, 0, storage_key);
+ AXIS2_TRUE, 0, storage_key);
axis2_msg_ctx_set_property(msg_ctx, env, SANDESHA2_MESSAGE_STORE_KEY,
property);
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=615602&r1=615601&r2=615602&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/util/terminate_mgr.c (original)
+++ webservices/sandesha/trunk/c/src/util/terminate_mgr.c Sun Jan 27 05:57:59
2008
@@ -823,6 +823,8 @@
terminate_added);
if(internal_seq_id)
AXIS2_FREE(env->allocator, internal_seq_id);
+ if(terminate_added)
+ sandesha2_seq_property_bean_free(terminate_added, env);
}
if(rm_ver)
AXIS2_FREE(env->allocator, rm_ver);
@@ -872,7 +874,8 @@
sandesha2_seq_property_bean_set_value(terminate_added, env,
AXIS2_VALUE_TRUE);
sandesha2_seq_property_mgr_insert(seq_prop_mgr, env, terminate_added);
-
+ if(terminate_added)
+ sandesha2_seq_property_bean_free(terminate_added, env);
msg_ctx1 = sandesha2_msg_ctx_get_msg_ctx(terminate_rm_msg, env);
if(terminate_rm_msg)
sandesha2_msg_ctx_free(terminate_rm_msg, env);
@@ -883,7 +886,7 @@
axis2_msg_ctx_set_property(msg_ctx1, env,
SANDESHA2_ORIGINAL_TRANSPORT_OUT_DESC, property);
- property = axutil_property_create_with_args(env, 0, 0, 0, key);
+ property = axutil_property_create_with_args(env, 0, AXIS2_TRUE, 0, key);
axis2_msg_ctx_set_property(msg_ctx1, env, SANDESHA2_MESSAGE_STORE_KEY,
property);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]