You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ma...@apache.org on 2007/06/07 05:39:50 UTC
svn commit: r545047 - in /webservices/axis2/trunk/c/neethi: include/ src/
src/secpolicy/builder/
Author: manjula
Date: Wed Jun 6 20:39:49 2007
New Revision: 545047
URL: http://svn.apache.org/viewvc?view=rev&rev=545047
Log:
Fixing memory leaks in policy normalization logic.
Modified:
webservices/axis2/trunk/c/neethi/include/neethi_policy.h
webservices/axis2/trunk/c/neethi/src/engine.c
webservices/axis2/trunk/c/neethi/src/policy.c
webservices/axis2/trunk/c/neethi/src/secpolicy/builder/asymmetric_binding_builder.c
webservices/axis2/trunk/c/neethi/src/secpolicy/builder/initiator_token_builder.c
webservices/axis2/trunk/c/neethi/src/secpolicy/builder/recipient_token_builder.c
webservices/axis2/trunk/c/neethi/src/secpolicy/builder/secpolicy_builder.c
webservices/axis2/trunk/c/neethi/src/secpolicy/builder/supporting_tokens_builder.c
webservices/axis2/trunk/c/neethi/src/secpolicy/builder/username_token_builder.c
webservices/axis2/trunk/c/neethi/src/secpolicy/builder/wss10_builder.c
webservices/axis2/trunk/c/neethi/src/secpolicy/builder/x509_token_builder.c
Modified: webservices/axis2/trunk/c/neethi/include/neethi_policy.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/include/neethi_policy.h?view=diff&rev=545047&r1=545046&r2=545047
==============================================================================
--- webservices/axis2/trunk/c/neethi/include/neethi_policy.h (original)
+++ webservices/axis2/trunk/c/neethi/include/neethi_policy.h Wed Jun 6 20:39:49 2007
@@ -102,7 +102,11 @@
axiom_node_t *parent,
const axutil_env_t *env);
-
+ AXIS2_EXTERN axis2_status_t AXIS2_CALL
+ neethi_policy_set_components_null(
+ neethi_policy_t *policy,
+ const axutil_env_t *env);
+
/** @} */
#ifdef __cplusplus
Modified: webservices/axis2/trunk/c/neethi/src/engine.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/engine.c?view=diff&rev=545047&r1=545046&r2=545047
==============================================================================
--- webservices/axis2/trunk/c/neethi/src/engine.c (original)
+++ webservices/axis2/trunk/c/neethi/src/engine.c Wed Jun 6 20:39:49 2007
@@ -492,7 +492,7 @@
neethi_operator_set_value(component,env,exactlyone,OPERATOR_TYPE_EXACTLYONE);
neethi_policy_add_operator(resultant_neethi_policy,env,component);
- check_neethi_policy(resultant_neethi_policy,env);
+ /*check_neethi_policy(resultant_neethi_policy,env);*/
return resultant_neethi_policy;
}
else
@@ -714,6 +714,8 @@
neethi_policy = (neethi_policy_t *)neethi_operator_get_value(child_component,env);
children = neethi_policy_get_policy_components(neethi_policy,env);
neethi_all_add_policy_components(all,children,env);
+ axutil_array_list_free(children, env);
+ children = NULL;
to_normalize = neethi_operator_create(env);
neethi_operator_set_value(to_normalize,env,all,OPERATOR_TYPE_ALL);
exactlyone = normalize_operator(to_normalize,registry,deep,env);
@@ -748,6 +750,8 @@
policy = (neethi_policy_t *)neethi_operator_get_value(child_component,env);
children = neethi_policy_get_policy_components(policy,env);
neethi_all_add_policy_components(all,children,env);
+ axutil_array_list_free(children, env);
+ children = NULL;
to_normalize = neethi_operator_create(env);
neethi_operator_set_value(to_normalize,env,all,OPERATOR_TYPE_ALL);
exactlyone = normalize_operator(to_normalize,registry,deep,env);
@@ -760,6 +764,8 @@
axutil_array_list_add(child_component_list,env,exactlyone);
}
}
+ axutil_array_list_free(arraylist, env);
+ arraylist = NULL;
return compute_resultant_component(child_component_list,type,env);
}
Modified: webservices/axis2/trunk/c/neethi/src/policy.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/policy.c?view=diff&rev=545047&r1=545046&r2=545047
==============================================================================
--- webservices/axis2/trunk/c/neethi/src/policy.c (original)
+++ webservices/axis2/trunk/c/neethi/src/policy.c Wed Jun 6 20:39:49 2007
@@ -197,15 +197,15 @@
const axutil_env_t *env)
{
- neethi_policy_t *normalized = NULL;
+ /*neethi_policy_t *normalized = NULL;*/
neethi_exactlyone_t *exactlyone = NULL;
- normalized = neethi_engine_get_normalize(env, AXIS2_FALSE, neethi_policy);
+ /*normalized = neethi_engine_get_normalize(env, AXIS2_FALSE, neethi_policy);*/
- if(!normalized)
- return NULL;
+ /*if(!normalized)
+ return NULL;*/
- exactlyone = neethi_policy_get_exactlyone(normalized, env);
+ exactlyone = neethi_policy_get_exactlyone(neethi_policy, env);
if(!exactlyone)
return NULL;
@@ -303,3 +303,13 @@
}
return policy_node;
}
+
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+neethi_policy_set_components_null(
+ neethi_policy_t *policy,
+ const axutil_env_t *env)
+{
+ policy->policy_components = NULL;
+ return AXIS2_SUCCESS;
+}
+
Modified: webservices/axis2/trunk/c/neethi/src/secpolicy/builder/asymmetric_binding_builder.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/secpolicy/builder/asymmetric_binding_builder.c?view=diff&rev=545047&r1=545046&r2=545047
==============================================================================
--- webservices/axis2/trunk/c/neethi/src/secpolicy/builder/asymmetric_binding_builder.c (original)
+++ webservices/axis2/trunk/c/neethi/src/secpolicy/builder/asymmetric_binding_builder.c Wed Jun 6 20:39:49 2007
@@ -48,6 +48,7 @@
neethi_operator_t *component = NULL;
neethi_all_t *all = NULL;
neethi_assertion_t *assertion = NULL;
+ neethi_policy_t *normalized_policy = NULL;
asymmetric_binding = rp_asymmetric_binding_create(env);
@@ -63,8 +64,11 @@
{
return NULL;
}
- policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
- alternatives = neethi_policy_get_alternatives(policy, env);
+ normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
+ neethi_policy_set_components_null(policy, env);
+ neethi_policy_free(policy, env);
+ policy = NULL;
+ alternatives = neethi_policy_get_alternatives(normalized_policy, env);
component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0);
all = (neethi_all_t *)neethi_operator_get_value(component ,env);
asymmetric_binding_process_alternatives(env, all, asymmetric_binding);
@@ -72,6 +76,9 @@
/*assertion = neethi_assertion_create(env);
neethi_assertion_set_value(assertion, env, asymmetric_binding, ASSERTION_TYPE_ASSYMMETRIC_BINDING);*/
assertion = neethi_assertion_create_with_args(env, (void *)rp_asymmetric_binding_free, asymmetric_binding, ASSERTION_TYPE_ASSYMMETRIC_BINDING);
+ /*neethi_policy_free(policy, env);
+ policy = NULL;*/
+
return assertion;
}
else return NULL;
Modified: webservices/axis2/trunk/c/neethi/src/secpolicy/builder/initiator_token_builder.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/secpolicy/builder/initiator_token_builder.c?view=diff&rev=545047&r1=545046&r2=545047
==============================================================================
--- webservices/axis2/trunk/c/neethi/src/secpolicy/builder/initiator_token_builder.c (original)
+++ webservices/axis2/trunk/c/neethi/src/secpolicy/builder/initiator_token_builder.c Wed Jun 6 20:39:49 2007
@@ -49,6 +49,7 @@
neethi_operator_t *component = NULL;
neethi_all_t *all = NULL;
neethi_assertion_t *assertion = NULL;
+ neethi_policy_t *normalized_policy = NULL;
initiator_token = rp_property_create(env);
@@ -64,8 +65,11 @@
{
return NULL;
}
- policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
- alternatives =neethi_policy_get_alternatives(policy, env);
+ normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
+ neethi_policy_set_components_null(policy, env);
+ neethi_policy_free(policy, env);
+ policy = NULL;
+ alternatives =neethi_policy_get_alternatives(normalized_policy, env);
component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0);
all = (neethi_all_t *)neethi_operator_get_value(component ,env);
initiator_token_process_alternatives(env, all, initiator_token);
Modified: webservices/axis2/trunk/c/neethi/src/secpolicy/builder/recipient_token_builder.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/secpolicy/builder/recipient_token_builder.c?view=diff&rev=545047&r1=545046&r2=545047
==============================================================================
--- webservices/axis2/trunk/c/neethi/src/secpolicy/builder/recipient_token_builder.c (original)
+++ webservices/axis2/trunk/c/neethi/src/secpolicy/builder/recipient_token_builder.c Wed Jun 6 20:39:49 2007
@@ -49,6 +49,7 @@
neethi_operator_t *component = NULL;
neethi_all_t *all = NULL;
neethi_assertion_t *assertion = NULL;
+ neethi_policy_t *normalized_policy = NULL;
recipient_token = rp_property_create(env);
@@ -64,8 +65,11 @@
{
return NULL;
}
- policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
- alternatives =neethi_policy_get_alternatives(policy, env);
+ normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
+ neethi_policy_set_components_null(policy, env);
+ neethi_policy_free(policy, env);
+ policy = NULL;
+ alternatives =neethi_policy_get_alternatives(normalized_policy, env);
component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0);
all = (neethi_all_t *)neethi_operator_get_value(component ,env);
recipient_token_process_alternatives(env, all, recipient_token);
Modified: webservices/axis2/trunk/c/neethi/src/secpolicy/builder/secpolicy_builder.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/secpolicy/builder/secpolicy_builder.c?view=diff&rev=545047&r1=545046&r2=545047
==============================================================================
--- webservices/axis2/trunk/c/neethi/src/secpolicy/builder/secpolicy_builder.c (original)
+++ webservices/axis2/trunk/c/neethi/src/secpolicy/builder/secpolicy_builder.c Wed Jun 6 20:39:49 2007
@@ -43,10 +43,12 @@
neethi_operator_t *component = NULL;
neethi_all_t *all = NULL;
rp_secpolicy_t *secpolicy = NULL;
+ /*neethi_policy_t *normalized_policy = NULL;*/
secpolicy = rp_secpolicy_create(env);
- policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
+ /*normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);*/
+
alternatives = neethi_policy_get_alternatives(policy, env);
component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0);
Modified: webservices/axis2/trunk/c/neethi/src/secpolicy/builder/supporting_tokens_builder.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/secpolicy/builder/supporting_tokens_builder.c?view=diff&rev=545047&r1=545046&r2=545047
==============================================================================
--- webservices/axis2/trunk/c/neethi/src/secpolicy/builder/supporting_tokens_builder.c (original)
+++ webservices/axis2/trunk/c/neethi/src/secpolicy/builder/supporting_tokens_builder.c Wed Jun 6 20:39:49 2007
@@ -55,6 +55,7 @@
neethi_all_t *all = NULL;
neethi_assertion_t *assertion = NULL;
axis2_char_t *local_name = NULL;
+ neethi_policy_t *normalized_policy = NULL;
supporting_tokens = rp_supporting_tokens_create(env);
local_name = axiom_element_get_localname(element, env);
@@ -85,8 +86,11 @@
{
return NULL;
}
- policy = neethi_engine_get_normalize(env, AXIS2_FALSE,policy);
- alternatives = neethi_policy_get_alternatives(policy, env);
+ normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE,policy);
+ neethi_policy_set_components_null(policy, env);
+ neethi_policy_free(policy, env);
+ policy = NULL;
+ alternatives = neethi_policy_get_alternatives(normalized_policy, env);
component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0);
all = (neethi_all_t *)neethi_operator_get_value(component ,env);
supporting_tokens_process_alternatives(env, all, supporting_tokens);
Modified: webservices/axis2/trunk/c/neethi/src/secpolicy/builder/username_token_builder.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/secpolicy/builder/username_token_builder.c?view=diff&rev=545047&r1=545046&r2=545047
==============================================================================
--- webservices/axis2/trunk/c/neethi/src/secpolicy/builder/username_token_builder.c (original)
+++ webservices/axis2/trunk/c/neethi/src/secpolicy/builder/username_token_builder.c Wed Jun 6 20:39:49 2007
@@ -50,6 +50,7 @@
axis2_char_t *inclusion_value = NULL;
axutil_qname_t *qname = NULL;
neethi_assertion_t *assertion = NULL;
+ neethi_policy_t *normalized_policy = NULL;
username_token = rp_username_token_create(env);
qname = axutil_qname_create(env,RP_INCLUDE_TOKEN,RP_SP_NS,RP_SP_PREFIX);
@@ -79,8 +80,11 @@
{
return NULL;
}
- policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
- alternatives = neethi_policy_get_alternatives(policy, env);
+ normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
+ neethi_policy_set_components_null(policy, env);
+ neethi_policy_free(policy, env);
+ policy = NULL;
+ alternatives = neethi_policy_get_alternatives(normalized_policy, env);
component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0);
all = (neethi_all_t *)neethi_operator_get_value(component ,env);
username_token_process_alternatives(env, all, username_token);
Modified: webservices/axis2/trunk/c/neethi/src/secpolicy/builder/wss10_builder.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/secpolicy/builder/wss10_builder.c?view=diff&rev=545047&r1=545046&r2=545047
==============================================================================
--- webservices/axis2/trunk/c/neethi/src/secpolicy/builder/wss10_builder.c (original)
+++ webservices/axis2/trunk/c/neethi/src/secpolicy/builder/wss10_builder.c Wed Jun 6 20:39:49 2007
@@ -48,6 +48,7 @@
neethi_operator_t *component = NULL;
neethi_all_t *all = NULL;
neethi_assertion_t *assertion = NULL;
+ neethi_policy_t *normalized_policy = NULL;
wss10 = rp_wss10_create(env);
@@ -63,8 +64,11 @@
{
return NULL;
}
- policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
- alternatives = neethi_policy_get_alternatives(policy, env);
+ normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
+ neethi_policy_set_components_null(policy, env);
+ neethi_policy_free(policy, env);
+ policy = NULL;
+ alternatives = neethi_policy_get_alternatives(normalized_policy, env);
component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0);
all = (neethi_all_t *)neethi_operator_get_value(component ,env);
wss10_process_alternatives(env, all, wss10);
Modified: webservices/axis2/trunk/c/neethi/src/secpolicy/builder/x509_token_builder.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/neethi/src/secpolicy/builder/x509_token_builder.c?view=diff&rev=545047&r1=545046&r2=545047
==============================================================================
--- webservices/axis2/trunk/c/neethi/src/secpolicy/builder/x509_token_builder.c (original)
+++ webservices/axis2/trunk/c/neethi/src/secpolicy/builder/x509_token_builder.c Wed Jun 6 20:39:49 2007
@@ -50,6 +50,7 @@
axis2_char_t *inclusion_value = NULL;
axutil_qname_t *qname = NULL;
neethi_assertion_t *assertion = NULL;
+ neethi_policy_t *normalized_policy = NULL;
x509_token = rp_x509_token_create(env);
qname = axutil_qname_create(env,RP_INCLUDE_TOKEN,RP_SP_NS,RP_SP_PREFIX);
@@ -73,8 +74,11 @@
{
return NULL;
}
- policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
- alternatives = neethi_policy_get_alternatives(policy, env);
+ normalized_policy = neethi_engine_get_normalize(env, AXIS2_FALSE, policy);
+ neethi_policy_set_components_null(policy, env);
+ neethi_policy_free(policy, env);
+ policy = NULL;
+ alternatives = neethi_policy_get_alternatives(normalized_policy, env);
component = (neethi_operator_t *)axutil_array_list_get(alternatives, env, 0);
all = (neethi_all_t *)neethi_operator_get_value(component ,env);
x509_token_process_alternatives(env, all, x509_token);
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org