You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sa...@apache.org on 2006/03/21 10:37:22 UTC
svn commit: r387471 - in /webservices/axis2/trunk/c/modules/core:
description/handler_desc.c engine/conf.c engine/handler.c
Author: samisa
Date: Tue Mar 21 01:37:21 2006
New Revision: 387471
URL: http://svn.apache.org/viewcvs?rev=387471&view=rev
Log:
Fixed handler related memory leaks
Modified:
webservices/axis2/trunk/c/modules/core/description/handler_desc.c
webservices/axis2/trunk/c/modules/core/engine/conf.c
webservices/axis2/trunk/c/modules/core/engine/handler.c
Modified: webservices/axis2/trunk/c/modules/core/description/handler_desc.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/description/handler_desc.c?rev=387471&r1=387470&r2=387471&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/description/handler_desc.c (original)
+++ webservices/axis2/trunk/c/modules/core/description/handler_desc.c Tue Mar 21 01:37:21 2006
@@ -297,7 +297,7 @@
handler_desc_impl = AXIS2_INTF_TO_IMPL(handler_desc);
- if (handler_desc_impl->handler)
+ if (handler_desc_impl->handler && (handler_desc_impl->handler != handler))
{
AXIS2_HANDLER_FREE(handler_desc_impl->handler, env);
handler_desc_impl->handler = NULL;
Modified: webservices/axis2/trunk/c/modules/core/engine/conf.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/engine/conf.c?rev=387471&r1=387470&r2=387471&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/engine/conf.c (original)
+++ webservices/axis2/trunk/c/modules/core/engine/conf.c Tue Mar 21 01:37:21 2006
@@ -55,6 +55,7 @@
axis2_hash_t *faulty_modules;
axis2_char_t *axis2_repos;
axis2_dep_engine_t *dep_engine;
+ axis2_array_list_t *handlers;
};
#define AXIS2_INTF_TO_IMPL(conf) ((axis2_conf_impl_t *)conf)
@@ -437,7 +438,15 @@
AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
return NULL;
}*/
-
+
+ config_impl->handlers = axis2_array_list_create(env, 0);
+ if(NULL == config_impl->handlers)
+ {
+ axis2_conf_free(&(config_impl->conf), env);
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+
config_impl->all_svcs = axis2_hash_make(env);
if(NULL == config_impl->all_svcs)
{
@@ -822,6 +831,24 @@
config_impl->dep_engine= NULL;
}
+ if(config_impl->handlers)
+ {
+ int i = 0;
+ for (i = 0; i < AXIS2_ARRAY_LIST_SIZE(config_impl->handlers, env); i++)
+ {
+ axis2_handler_desc_t *handler_desc = NULL;
+ handler_desc = (axis2_handler_desc_t *)
+ AXIS2_ARRAY_LIST_GET(config_impl->handlers, env, i);
+ if (handler_desc)
+ AXIS2_HANDLER_FREE (handler_desc, env);
+
+ handler_desc = NULL;
+
+ }
+ AXIS2_ARRAY_LIST_FREE(config_impl->handlers, env);
+ config_impl->handlers = NULL;
+ }
+
if(config_impl->axis2_repos)
{
AXIS2_FREE((*env)->allocator, config_impl->axis2_repos);
@@ -1634,9 +1661,11 @@
AXIS2_PHASE_FREE(dispatch, env);
return AXIS2_FAILURE;
}
+
handler = AXIS2_DISP_GET_BASE(add_dispatch, env);
AXIS2_DISP_FREE(add_dispatch, env);
AXIS2_PHASE_ADD_HANDLER_AT(dispatch, env, 0, handler);
+ AXIS2_ARRAY_LIST_ADD(config_impl->handlers, env, AXIS2_HANDLER_GET_HANDLER_DESC(handler, env));
handler = NULL;
uri_dispatch = axis2_req_uri_disp_create(env);
@@ -1644,9 +1673,11 @@
{
return AXIS2_FAILURE;
}
+
handler = AXIS2_DISP_GET_BASE(uri_dispatch, env);
AXIS2_DISP_FREE(uri_dispatch, env);
AXIS2_PHASE_ADD_HANDLER_AT(dispatch, env, 1, handler);
+ AXIS2_ARRAY_LIST_ADD(config_impl->handlers, env, AXIS2_HANDLER_GET_HANDLER_DESC(handler, env));
handler = NULL;
soap_action_based_dispatch = axis2_soap_action_disp_create(env);
@@ -1654,9 +1685,11 @@
{
return AXIS2_FAILURE;
}
+
handler = AXIS2_DISP_GET_BASE(soap_action_based_dispatch, env);
AXIS2_DISP_FREE(soap_action_based_dispatch, env);
AXIS2_PHASE_ADD_HANDLER_AT(dispatch, env, 2, handler);
+ AXIS2_ARRAY_LIST_ADD(config_impl->handlers, env, AXIS2_HANDLER_GET_HANDLER_DESC(handler, env));
handler = NULL;
soap_msg_body_based_dispatch = axis2_soap_body_disp_create(env);
@@ -1664,9 +1697,11 @@
{
return AXIS2_FAILURE;
}
+
handler = AXIS2_DISP_GET_BASE(soap_msg_body_based_dispatch, env);
AXIS2_DISP_FREE(soap_msg_body_based_dispatch, env);
AXIS2_PHASE_ADD_HANDLER_AT(dispatch, env, 3, handler);
+ AXIS2_ARRAY_LIST_ADD(config_impl->handlers, env, AXIS2_HANDLER_GET_HANDLER_DESC(handler, env));
handler = NULL;
status = AXIS2_ARRAY_LIST_ADD(config_impl->
@@ -1688,10 +1723,12 @@
handler = AXIS2_DISP_CHECKER_GET_BASE(disp_checker, env);
AXIS2_DISP_CHECKER_FREE(disp_checker, env);
AXIS2_PHASE_ADD_HANDLER_AT(post_dispatch, env, 0, handler);
+ AXIS2_ARRAY_LIST_ADD(config_impl->handlers, env, AXIS2_HANDLER_GET_HANDLER_DESC(handler, env));
handler = NULL;
handler = axis2_ctx_handler_create(env, NULL);
AXIS2_PHASE_ADD_HANDLER_AT(post_dispatch, env, 1, handler);
+ AXIS2_ARRAY_LIST_ADD(config_impl->handlers, env, AXIS2_HANDLER_GET_HANDLER_DESC(handler, env));
status = AXIS2_ARRAY_LIST_ADD(config_impl->
in_phases_upto_and_including_post_dispatch, env, post_dispatch);
Modified: webservices/axis2/trunk/c/modules/core/engine/handler.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/engine/handler.c?rev=387471&r1=387470&r2=387471&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/engine/handler.c (original)
+++ webservices/axis2/trunk/c/modules/core/engine/handler.c Tue Mar 21 01:37:21 2006
@@ -148,6 +148,7 @@
{
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
AXIS2_INTF_TO_IMPL(handler)->handler_desc = handler_desc;
+ AXIS2_HANDLER_DESC_SET_HANDLER(handler_desc, env, handler);
return AXIS2_SUCCESS;
}