Author: damitha
Date: Thu Jan 24 06:23:24 2008
New Revision: 614879
URL: http://svn.apache.org/viewvc?rev=614879&view=rev
Log:
Fixing memory leaks
Modified:
webservices/sandesha/trunk/c/samples/RMSampleService/rm_sample_svc.c
webservices/sandesha/trunk/c/samples/rm_echo_single_1_0/echo_util.c
webservices/sandesha/trunk/c/samples/rm_echo_single_1_0/rm_echo_single.c
webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c
webservices/sandesha/trunk/c/src/storage/sqlite/permanent_storage_mgr.c
Modified: webservices/sandesha/trunk/c/samples/RMSampleService/rm_sample_svc.c
URL:
http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/RMSampleService/rm_sample_svc.c?rev=614879&r1=614878&r2=614879&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/samples/RMSampleService/rm_sample_svc.c
(original)
+++ webservices/sandesha/trunk/c/samples/RMSampleService/rm_sample_svc.c Thu
Jan 24 06:23:24 2008
@@ -58,35 +58,24 @@
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_SVC_SKEL_INPUT_OM_NODE_NULL,
AXIS2_FAILURE);
return NULL;
}
- else
- {
- axiom_xml_writer_t *writer = NULL;
- axiom_output_t *om_output = NULL;
- axis2_char_t *buffer = NULL;
-
- writer = axiom_xml_writer_create_for_memory(env, NULL, AXIS2_TRUE, 0,
- AXIS2_XML_PARSER_TYPE_BUFFER);
- om_output = axiom_output_create (env, writer);
-
- axiom_node_serialize (node, env, om_output);
- buffer = axiom_xml_writer_get_xml(writer, env);
- }
-
- element = axiom_node_get_data_element(node, env);
+ /*element = axiom_node_get_data_element(node, env);
qname = axutil_qname_create(env, "Text", ns, NULL);
text_parent_element = axiom_element_get_first_child_with_qname(element,
env,
qname, node, &text_parent_node);
- axutil_qname_free(qname, env);
+ axutil_qname_free(qname, env);*/
+ text_parent_node = axiom_node_get_first_element(node, env);
if (!text_parent_node) /* 'text' node */
{
- AXIS2_ERROR_SET(env->error,
AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST, AXIS2_FAILURE);
+ AXIS2_ERROR_SET(env->error,
+ AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST, AXIS2_FAILURE);
return NULL;
}
text_node = axiom_node_get_first_child(text_parent_node, env);
if (!text_node) /* actual text to echo */
{
- AXIS2_ERROR_SET(env->error,
AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST, AXIS2_FAILURE);
+ AXIS2_ERROR_SET(env->error,
+ AXIS2_ERROR_SVC_SKEL_INVALID_XML_FORMAT_IN_REQUEST, AXIS2_FAILURE);
return NULL;
}
Modified: webservices/sandesha/trunk/c/samples/rm_echo_single_1_0/echo_util.c
URL:
http://svn.apache.org/viewvc/webservices/sandesha/trunk/c/samples/rm_echo_single_1_0/echo_util.c?rev=614879&r1=614878&r2=614879&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/samples/rm_echo_single_1_0/echo_util.c
(original)
+++ webservices/sandesha/trunk/c/samples/rm_echo_single_1_0/echo_util.c Thu Jan
24 06:23:24 2008
@@ -37,14 +37,18 @@
ns1 = axiom_namespace_create (env, ns, "ns1");
echo_om_ele = axiom_element_create(env, NULL, "echoString", ns1,
&echo_om_node);
- text_om_ele = axiom_element_create(env, echo_om_node, "Text", ns1,
&text_om_node);
- seq_om_ele = axiom_element_create(env, echo_om_node, "Sequence", ns1,
&seq_om_node);
+ text_om_ele = axiom_element_create(env, echo_om_node, "Text", NULL,
&text_om_node);
+ seq_om_ele = axiom_element_create(env, echo_om_node, "Sequence", NULL,
&seq_om_node);
axiom_element_set_text(text_om_ele, env, text, text_om_node);
- axiom_element_set_text(text_om_ele, env, seq, seq_om_node);
+ axiom_element_set_text(seq_om_ele, env, seq, seq_om_node);
om_str = axiom_node_to_string(echo_om_node, env);
if (om_str)
+ {
printf("\nSending OM : %s\n", om_str);
+ AXIS2_FREE(env->allocator, om_str);
+ om_str = NULL;
+ }
return echo_om_node;
}
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=614879&r1=614878&r2=614879&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
Thu Jan 24 06:23:24 2008
@@ -61,6 +61,8 @@
const axis2_char_t *client_home = NULL;
axis2_svc_client_t* svc_client = NULL;
axiom_node_t *payload = NULL;
+ axiom_node_t *payload2 = NULL;
+ axiom_node_t *payload3 = NULL;
axutil_property_t *property = NULL;
axis2_char_t *offered_seq_id = NULL;
axiom_node_t *result = NULL;
@@ -185,58 +187,58 @@
axis2_char_t *om_str = NULL;
om_str = axiom_node_to_string(result, env);
if (om_str)
+ {
printf("\nReceived OM : %s\n", om_str);
+ AXIS2_FREE(env->allocator, om_str);
+ }
printf("\necho client two way single channel invoke SUCCESSFUL!\n");
-
- AXIS2_FREE(env->allocator, om_str);
result = NULL;
}
else
{
printf("\necho client two way single channel invoke FAILED!\n");
}
- payload = NULL;
- payload = build_om_payload_for_echo_svc(env, "echo2", seq_key);
- result = axis2_svc_client_send_receive(svc_client, env, payload);
+ payload2 = build_om_payload_for_echo_svc(env, "echo2", seq_key);
+ result = axis2_svc_client_send_receive(svc_client, env, payload2);
if(result)
{
axis2_char_t *om_str = NULL;
om_str = axiom_node_to_string(result, env);
if (om_str)
+ {
printf("\nReceived OM : %s\n", om_str);
+ AXIS2_FREE(env->allocator, om_str);
+ }
printf("\necho client two way single channel invoke SUCCESSFUL!\n");
-
- AXIS2_FREE(env->allocator, om_str);
result = NULL;
}
else
{
printf("\necho client two way single channel invoke FAILED!\n");
}
- payload = NULL;
property = axutil_property_create_with_args(env, 0, 0, 0,
AXIS2_VALUE_TRUE);
axis2_options_set_property(options, env, "Sandesha2LastMessage", property);
- payload = build_om_payload_for_echo_svc(env, "echo3", "sequence1");
- result = axis2_svc_client_send_receive(svc_client, env, payload);
+ payload3 = build_om_payload_for_echo_svc(env, "echo3", seq_key);
+ result = axis2_svc_client_send_receive(svc_client, env, payload3);
if(result)
{
axis2_char_t *om_str = NULL;
om_str = axiom_node_to_string(result, env);
if (om_str)
+ {
printf("\nReceived OM : %s\n", om_str);
+ AXIS2_FREE(env->allocator, om_str);
+ }
printf("\necho client two way single channel invoke SUCCESSFUL!\n");
-
- AXIS2_FREE(env->allocator, om_str);
result = NULL;
}
else
{
printf("\necho client two way single channel invoke FAILED!\n");
}
- payload = NULL;
AXIS2_SLEEP(SANDESHA2_MAX_COUNT);
AXIS2_FREE(env->allocator, seq_key);
if(offered_seq_id)
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=614879&r1=614878&r2=614879&view=diff
==============================================================================
--- webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c
(original)
+++ webservices/sandesha/trunk/c/src/msgprocessors/app_msg_processor.c Thu Jan
24 06:23:24 2008
@@ -521,6 +521,12 @@
sandesha2_seq_property_mgr_insert(seq_prop_mgr, env,
highest_msg_id_bean);
}
+ if(highest_msg_no_bean)
+ sandesha2_seq_property_bean_free(highest_msg_no_bean, env);
+ if(highest_msg_key_bean)
+ sandesha2_seq_property_bean_free(highest_msg_key_bean, env);
+ if(highest_msg_id_bean)
+ sandesha2_seq_property_bean_free(highest_msg_id_bean, env);
}
if(highest_in_msg_no_str)
AXIS2_FREE(env->allocator, highest_in_msg_no_str);
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=614879&r1=614878&r2=614879&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 Thu
Jan 24 06:23:24 2008
@@ -317,36 +317,45 @@
int msg_type)
{
sandesha2_permanent_storage_mgr_t *storage_mgr_impl = NULL;
+ axis2_msg_ctx_t *msg_ctx = NULL;
+ axutil_property_t *property = NULL;
+ axis2_ctx_t *ctx = axis2_conf_ctx_get_base(conf_ctx, env);
+ axutil_hash_t *msg_ctx_map = NULL;
storage_mgr_impl = SANDESHA2_INTF_TO_IMPL(storage_mgr);
- {
- void *entry = NULL;
- axis2_msg_ctx_t *msg_ctx = NULL;
- axutil_property_t *property = NULL;
- axis2_ctx_t *ctx = axis2_conf_ctx_get_base(conf_ctx, env);
- axutil_hash_t *msg_ctx_map = NULL;
- property = axis2_ctx_get_property(ctx, env, SANDESHA2_MSG_CTX_MAP);
- if(property)
+ property = axis2_ctx_get_property(ctx, env, SANDESHA2_MSG_CTX_MAP);
+ if(property)
+ {
+ msg_ctx_map = axutil_property_get_value(property, env);
+ if(msg_ctx_map)
{
- msg_ctx_map = axutil_property_get_value(property, env);
- if(msg_ctx_map)
+ axutil_hash_index_t *i = NULL;
+ for (i = axutil_hash_first(msg_ctx_map, env); i; i =
+ axutil_hash_next(env, i))
{
- entry = axutil_hash_get(msg_ctx_map, key,
AXIS2_HASH_KEY_STRING);
- msg_ctx = (axis2_msg_ctx_t *) entry;
- }
- if(entry)
- {
- axis2_op_ctx_t *op_ctx = NULL;
- 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);
- if(msg_type != SANDESHA2_MSG_TYPE_APPLICATION &&
- msg_type !=SANDESHA2_MSG_TYPE_CREATE_SEQ)
+ const void *k = NULL;
+ void *v = NULL;
+ axis2_char_t *key_l = NULL;
+
+ axutil_hash_this(i, &k, NULL, &v);
+ key_l = (axis2_char_t *) k;
+ if (0 == axutil_strcmp(key, key_l))
{
- axis2_msg_ctx_set_keep_alive(msg_ctx, env, AXIS2_FALSE);
- axis2_msg_ctx_set_paused(msg_ctx, env, AXIS2_FALSE);
- axis2_msg_ctx_free(msg_ctx, env);
+ msg_ctx = (axis2_msg_ctx_t *) v;
+ axis2_op_ctx_t *op_ctx = NULL;
+ 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 &&
+ msg_type !=SANDESHA2_MSG_TYPE_CREATE_SEQ)
+ {
+ axis2_msg_ctx_set_keep_alive(msg_ctx, env,
AXIS2_FALSE);
+ axis2_msg_ctx_set_paused(msg_ctx, env, AXIS2_FALSE);
+ axis2_msg_ctx_free(msg_ctx, env);
+ }
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]