Author: kaushalye
Date: Wed Nov 28 00:23:31 2007
New Revision: 598903

URL: http://svn.apache.org/viewvc?rev=598903&view=rev
Log:
MEMORY LEAK FIXES

Modified:
    webservices/rampart/trunk/c/samples/callback/pwcb.c
    webservices/rampart/trunk/c/samples/client/sec_echo/update_n_run.bat
    webservices/rampart/trunk/c/src/omxmlsec/axiom.c
    webservices/rampart/trunk/c/src/omxmlsec/buffer.c
    webservices/rampart/trunk/c/src/omxmlsec/derivation.c
    webservices/rampart/trunk/c/src/omxmlsec/openssl/x509.c
    webservices/rampart/trunk/c/src/omxmlsec/sign_ctx.c
    webservices/rampart/trunk/c/src/omxmlsec/signature.c
    webservices/rampart/trunk/c/src/omxmlsec/tokens/token_length.c
    webservices/rampart/trunk/c/src/omxmlsec/tokens/token_offset.c
    webservices/rampart/trunk/c/src/omxmlsec/xml_signature.c
    webservices/rampart/trunk/c/src/util/rampart_context.c
    webservices/rampart/trunk/c/src/util/rampart_encryption.c
    webservices/rampart/trunk/c/src/util/rampart_handler_util.c
    webservices/rampart/trunk/c/src/util/rampart_sec_header_builder.c
    webservices/rampart/trunk/c/src/util/rampart_username_token.c
    webservices/rampart/trunk/c/src/util/rampart_util.c

Modified: webservices/rampart/trunk/c/samples/callback/pwcb.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/samples/callback/pwcb.c?rev=598903&r1=598902&r2=598903&view=diff
==============================================================================
--- webservices/rampart/trunk/c/samples/callback/pwcb.c (original)
+++ webservices/rampart/trunk/c/samples/callback/pwcb.c Wed Nov 28 00:23:31 2007
@@ -29,6 +29,8 @@
 my_free_function(rampart_callback_t *rcb,
         const axutil_env_t *env)
 {
+       AXIS2_FREE(env->allocator, rcb->ops);
+       AXIS2_FREE(env->allocator, rcb);
     return AXIS2_SUCCESS;
 }
 
@@ -128,7 +130,7 @@
     axis2_status_t status = AXIS2_FAILURE;
     if (inst)
     {
-        status = AXIS2_SVC_SKELETON_FREE(inst, env);
+        status = my_free_function(inst, env);
     }
     return status;
 }

Modified: webservices/rampart/trunk/c/samples/client/sec_echo/update_n_run.bat
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/samples/client/sec_echo/update_n_run.bat?rev=598903&r1=598902&r2=598903&view=diff
==============================================================================
--- webservices/rampart/trunk/c/samples/client/sec_echo/update_n_run.bat 
(original)
+++ webservices/rampart/trunk/c/samples/client/sec_echo/update_n_run.bat Wed 
Nov 28 00:23:31 2007
@@ -1,12 +1,11 @@
 @echo off
 rem if your client repository is different, change the value.
-set CLIENT_REPO=%AXIS2C_HOME%\clientrepo
+set CLIENT_REPO=%AXIS2C_HOME%\client_repo
 
 rem INSTALL MODULE to make sure that both server and client have the same 
module.
 echo "Copying latest module to client_repo"
-xcopy /E /Y /I "%AXIS2C_HOME%\modules\rampart" "%CLIENT_REPO%\modules"
+xcopy /E /Y /I "%AXIS2C_HOME%\modules\rampart" "%CLIENT_REPO%\modules\rampart"
 
-echo RUN echo.exe http://localhost:9090/axis2/services/echo %CLIENT_REPO%
-"%AXIS2C_HOME%\bin\samples\rampart\client\enc_echo\enc_echo.exe" 
http://localhost:9090/axis2/services/echo "%CLIENT_REPO%"
+%AXIS2C_HOME%\bin\samples\rampart\client\sec_echo\echo.exe 
http://localhost:9090/axis2/services/sec_echo/echoString %CLIENT_REPO%
 
 @echo on

Modified: webservices/rampart/trunk/c/src/omxmlsec/axiom.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/axiom.c?rev=598903&r1=598902&r2=598903&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/axiom.c (original)
+++ webservices/rampart/trunk/c/src/omxmlsec/axiom.c Wed Nov 28 00:23:31 2007
@@ -293,15 +293,14 @@
     axutil_qname_free(qname, env);
     qname = NULL;
 
-    parent_name = axiom_node_to_string(parent, env);
     if (!node)
     {
+               parent_name = axiom_node_to_string(parent, env);
         oxs_error(env, ERROR_LOCATION, OXS_ERROR_INVALID_DATA,
                   "Cannot find child %s of %s", local_name, parent_name);
+               AXIS2_FREE(env->allocator, parent_name);
         return NULL;
     }
-    AXIS2_FREE(env->allocator, parent_name);
-    parent_name = NULL;
     return node;
 }
 
@@ -365,10 +364,14 @@
     {
         oxs_error(env, ERROR_LOCATION, OXS_ERROR_INVALID_DATA,
                   "Building node failed");
+               axiom_document_free(doc, env);
         return NULL;
     }
     axiom_stax_builder_free_self(builder, env);
     builder = NULL;
+
+       axiom_document_free_self(doc, env);
+       doc = NULL;
 
     /*The stax builder will free the reader.*/
     /*axiom_xml_reader_free(reader, env);

Modified: webservices/rampart/trunk/c/src/omxmlsec/buffer.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/buffer.c?rev=598903&r1=598902&r2=598903&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/buffer.c (original)
+++ webservices/rampart/trunk/c/src/omxmlsec/buffer.c Wed Nov 28 00:23:31 2007
@@ -61,6 +61,7 @@
     {
         oxs_error(env, ERROR_LOCATION, OXS_ERROR_DEFAULT,
                   "oxs_buffer_set_max_size");
+               AXIS2_FREE(env->allocator, buffer);
         return NULL;
     }
 

Modified: webservices/rampart/trunk/c/src/omxmlsec/derivation.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/derivation.c?rev=598903&r1=598902&r2=598903&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/derivation.c (original)
+++ webservices/rampart/trunk/c/src/omxmlsec/derivation.c Wed Nov 28 00:23:31 
2007
@@ -153,6 +153,7 @@
     dk_token = oxs_token_build_derived_key_token_element(env, parent, dk_id, 
NULL);
     str_token = oxs_token_build_security_token_reference_element(env, 
dk_token); 
     ref_token = oxs_token_build_reference_element(env, str_token, uri, 
stref_val_type);
+       AXIS2_FREE(env->allocator, uri);
 
     /*Create offset*/
     offset = oxs_key_get_offset(derived_key, env);

Modified: webservices/rampart/trunk/c/src/omxmlsec/openssl/x509.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/openssl/x509.c?rev=598903&r1=598902&r2=598903&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/openssl/x509.c (original)
+++ webservices/rampart/trunk/c/src/omxmlsec/openssl/x509.c Wed Nov 28 00:23:31 
2007
@@ -358,7 +358,8 @@
             
             encoded_str = AXIS2_MALLOC(env->allocator, 
axutil_base64_encode_len(_n));
             axutil_base64_encode(encoded_str, (char*)md, SHA_DIGEST_LENGTH);
-            BIO_printf(out, "%s", encoded_str);  
+            BIO_printf(out, "%s", encoded_str); 
+                       AXIS2_FREE(env->allocator, encoded_str);
         }
     }else if(OPENSSL_X509_INFO_SIGNATURE == type){
         int i = 0;

Modified: webservices/rampart/trunk/c/src/omxmlsec/sign_ctx.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/sign_ctx.c?rev=598903&r1=598902&r2=598903&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/sign_ctx.c (original)
+++ webservices/rampart/trunk/c/src/omxmlsec/sign_ctx.c Wed Nov 28 00:23:31 2007
@@ -273,6 +273,7 @@
     sign_ctx->prv_key = NULL;
     sign_ctx->pub_key = NULL;
     sign_ctx->operation = OXS_SIGN_OPERATION_NONE;
+       sign_ctx->secret=NULL;
     return sign_ctx;
 }
 

Modified: webservices/rampart/trunk/c/src/omxmlsec/signature.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/signature.c?rev=598903&r1=598902&r2=598903&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/signature.c (original)
+++ webservices/rampart/trunk/c/src/omxmlsec/signature.c Wed Nov 28 00:23:31 
2007
@@ -177,11 +177,14 @@
     status = oxs_sig_sign_hmac_sha1(env, sign_ctx, input_buf, output_buf); 
 
     signed_val = (axis2_char_t*)oxs_buffer_get_data(output_buf, env);
+       oxs_buffer_free(input_buf, env);
     /*Compare the output with the signature. If tally; SUCCESS*/
     if(axutil_strcmp(signature, signed_val)){
+               oxs_buffer_free(output_buf, env);
         return AXIS2_SUCCESS;
     }else{
         oxs_error(env, ERROR_LOCATION, OXS_ERROR_SIG_VERIFICATION_FAILED, 
"Signature verification failed using HMAC-SHA1");
+               oxs_buffer_free(output_buf, env);
         return AXIS2_FAILURE;
     }
 }

Modified: webservices/rampart/trunk/c/src/omxmlsec/tokens/token_length.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/tokens/token_length.c?rev=598903&r1=598902&r2=598903&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/tokens/token_length.c (original)
+++ webservices/rampart/trunk/c/src/omxmlsec/tokens/token_length.c Wed Nov 28 
00:23:31 2007
@@ -63,6 +63,7 @@
     if (length_val)
     {
         ret  = axiom_element_set_text(length_ele, env, length_val, 
length_node);
+               AXIS2_FREE(env->allocator, length_val);
     }
 
     return length_node;

Modified: webservices/rampart/trunk/c/src/omxmlsec/tokens/token_offset.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/tokens/token_offset.c?rev=598903&r1=598902&r2=598903&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/tokens/token_offset.c (original)
+++ webservices/rampart/trunk/c/src/omxmlsec/tokens/token_offset.c Wed Nov 28 
00:23:31 2007
@@ -67,6 +67,7 @@
     if (offset_val)
     {
         ret  = axiom_element_set_text(offset_ele, env, offset_val, 
offset_node);
+               AXIS2_FREE(env->allocator, offset_val);
     }
 
     return offset_node;

Modified: webservices/rampart/trunk/c/src/omxmlsec/xml_signature.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/xml_signature.c?rev=598903&r1=598902&r2=598903&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/xml_signature.c (original)
+++ webservices/rampart/trunk/c/src/omxmlsec/xml_signature.c Wed Nov 28 
00:23:31 2007
@@ -146,14 +146,14 @@
 
        id_name = oxs_sign_part_get_id_name(sign_part, env);
        if(!id_name)
-               id_name = axutil_strdup(env, OXS_ATTR_ID);
+               id_name = OXS_ATTR_ID;
 
        ns = oxs_sign_part_get_sign_namespace(sign_part, env);
 
        if(ns)
                ns_uri = axiom_namespace_get_uri(ns, env);
        else 
-               ns_uri = axutil_strdup(env, OXS_WSU_XMLNS);
+               ns_uri = OXS_WSU_XMLNS;
 
     /*Get the reference ID from the node and hence to the ds:Reference node*/
     id = oxs_axiom_get_attribute_value_of_node_by_name(env, node, id_name,
@@ -303,7 +303,7 @@
     }
     /*At this point we have a complete <SignedInfo> node. Now we need to sign 
it*/
     status = oxs_xml_sig_sign_signed_info(env, signature_node, 
signed_info_node, sign_ctx);
-       sig_id = axiom_node_to_string(parent, env);
+       /*sig_id = axiom_node_to_string(parent, env);*/
     *sig_node = signature_node;
     return status;
 }
@@ -393,6 +393,8 @@
                                                                
if(!axutil_strcmp(attr_val, ref_id2))
                                                                {
                                                                        attr = 
attribute;
+                                                                       if (env)
+                                                                               
AXIS2_FREE(env->allocator, hi);
                                                                        break;
                                                                }
                                                        }

Modified: webservices/rampart/trunk/c/src/util/rampart_context.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/util/rampart_context.c?rev=598903&r1=598902&r2=598903&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_context.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_context.c Wed Nov 28 00:23:31 
2007
@@ -213,16 +213,17 @@
         {
             axutil_param_t *param = NULL;
             param = rampart_context->password_callback_module->param;
+                       /*User specific free logic*/
+            RAMPART_CALLBACK_FREE(rampart_context->password_callback_module , 
env);
+            rampart_context->password_callback_module = NULL;
             if(param){
                 /*We actually free the dll_desc, which is set as the value of 
the axutil parameter.*/
-                axutil_dll_desc_t *dll_desc_l = NULL;
+                               axutil_param_free(param, env);
+                /*axutil_dll_desc_t *dll_desc_l = NULL;
                 dll_desc_l = axutil_param_get_value(param, env);
                 status = axutil_class_loader_delete_dll(env, dll_desc_l);
-                dll_desc_l = NULL;
+                dll_desc_l = NULL;*/
             }
-            /*User specific free logic*/
-            /*RAMPART_CALLBACK_FREE(rampart_context->password_callback_module 
, env);*/
-            rampart_context->password_callback_module = NULL;
         }
 
         if(rampart_context->authn_provider)
@@ -248,6 +249,18 @@
         }
 
         /*TODO Free derived key list*/
+               if (rampart_context->dk_list)
+               {
+                       int i;
+                       for(i=0 ; i < 
axutil_array_list_size(rampart_context->dk_list, env); i++)
+                       {
+                               oxs_key_t* dk = NULL;
+                               dk = 
(oxs_key_t*)axutil_array_list_get(rampart_context->dk_list, env, i);
+                               oxs_key_free(dk, env);
+                       }
+                       axutil_array_list_free(rampart_context->dk_list, env);
+                       rampart_context->dk_list = NULL;
+               }
 
         if(rampart_context->certificate){
             oxs_x509_cert_free(rampart_context->certificate, env);

Modified: webservices/rampart/trunk/c/src/util/rampart_encryption.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/util/rampart_encryption.c?rev=598903&r1=598902&r2=598903&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_encryption.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_encryption.c Wed Nov 28 
00:23:31 2007
@@ -445,6 +445,7 @@
     axis2_char_t *enc_sym_algo = NULL;
     oxs_key_t *session_key = NULL;
     axis2_bool_t server_side = AXIS2_FALSE;
+       axis2_bool_t free_session_key = AXIS2_FALSE;
     rp_property_type_t token_type;
     rp_property_t *token = NULL;
     int i = 0;
@@ -478,6 +479,8 @@
         {
             AXIS2_LOG_INFO(env->log,
                            "[rampart][rampart_encryption] No parts specified 
or specified parts can't be found for encryprion.");
+                       axutil_array_list_free(nodes_to_encrypt, env);
+                       nodes_to_encrypt = NULL;
             return AXIS2_SUCCESS;
         }
     }
@@ -491,6 +494,8 @@
             {
                 AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                                 "[rampart][rampart_encryption]Encrypting 
signature, Sigature Not found");
+                               axutil_array_list_free(nodes_to_encrypt, env);
+                               nodes_to_encrypt = NULL;
                 return AXIS2_FAILURE;
             }
             axutil_array_list_add(nodes_to_encrypt, env, sig_node);
@@ -504,6 +509,8 @@
     {
         AXIS2_LOG_INFO(env->log,
                        "[rampart][rampart_encryption]Encryption Token is not 
specified");
+               axutil_array_list_free(nodes_to_encrypt, env);
+               nodes_to_encrypt = NULL;
         return AXIS2_SUCCESS;
     }
     token_type = rp_property_get_type(token, env);
@@ -512,12 +519,16 @@
     {
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                         "[rampart][rampart_encryption]Specified token type not 
supported.");
+               axutil_array_list_free(nodes_to_encrypt, env);
+               nodes_to_encrypt = NULL;
         return AXIS2_FAILURE;
     }
     if(rampart_context_check_is_derived_keys(env,token))
     {
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                         "[rampart][rampart_encryption]We still do not support 
derived keys");
+               axutil_array_list_free(nodes_to_encrypt, env);
+               nodes_to_encrypt = NULL;
         return AXIS2_FAILURE;
     }
 
@@ -538,20 +549,28 @@
          session_key = oxs_key_create(env);
          status = oxs_key_for_algo(session_key, env, enc_sym_algo);
          rampart_context_set_session_key(rampart_context, env, session_key);
+                free_session_key = AXIS2_TRUE;
     }
     if(AXIS2_FAILURE == status)
     {
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                         "[rampart][rampart_encryption] Cannot generate the key 
for the algorithm %s, ", enc_sym_algo);
+               axutil_array_list_free(nodes_to_encrypt, env);
+               nodes_to_encrypt = NULL;
+               if (free_session_key)
+               {
+                       oxs_key_free(session_key, env);
+                       session_key = NULL;
+               }
         return AXIS2_FAILURE;
     }
 
     /*Key will be duplicated inside the function. So no worries freeing it 
here*/
-    if(rampart_context_is_encrypt_before_sign(rampart_context, env)
+    /*if(rampart_context_is_encrypt_before_sign(rampart_context, env)
             && signature_protection)
     {
         rampart_context_set_session_key(rampart_context, env, session_key);
-    }
+    }*/
 
     /*Create a list to store EncDataIds. This will be used in building the 
ReferenceList*/
 
@@ -574,6 +593,13 @@
         {
             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                             "[rampart][rampart_encryption] Cannot get the node 
from the list to encrypt");
+                       axutil_array_list_free(nodes_to_encrypt, env);
+                       nodes_to_encrypt = NULL;
+                       if (free_session_key)
+                       {
+                               oxs_key_free(session_key, env);
+                               session_key = NULL;
+                       }
             return AXIS2_FAILURE;
         }
         /*Create the encryption context for OMXMLSEC*/
@@ -597,6 +623,13 @@
             {
                 AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                                 "[rampart][rampart_encryption] Cannot encrypt 
the node " );
+                               axutil_array_list_free(nodes_to_encrypt, env);
+                               nodes_to_encrypt = NULL;
+                               if (free_session_key)
+                               {
+                                       oxs_key_free(session_key, env);
+                                       session_key = NULL;
+                               }
                 return AXIS2_FAILURE;
             }
         }
@@ -605,12 +638,18 @@
 
     }/*Eof For loop*/
 
-    /*TODO free list*/
+    /*free nodes_to_encrypt list*/
     axutil_array_list_free(nodes_to_encrypt, env);
     nodes_to_encrypt = NULL;
 
     /*We need to encrypt the session key.*/
     status = rampart_enc_encrypt_session_key(env, session_key, msg_ctx, 
rampart_context, soap_envelope, sec_node, id_list);
+       if (free_session_key)
+       {
+               oxs_key_free(session_key, env);
+               session_key = NULL;
+       }
+
     if(AXIS2_FAILURE == status){
         return AXIS2_FAILURE;
     }
@@ -632,11 +671,6 @@
         id_list = NULL;
     }
 
-
-
-    /*oxs_key_free(session_key, env);
-    session_key = NULL;*/
-
     return AXIS2_SUCCESS;
 }
 
@@ -892,6 +926,9 @@
  
         asym_key_id = oxs_axiom_get_attribute_value_of_node_by_name(env, 
encrypted_key_node, OXS_ATTR_ID, NULL);
         oxs_derivation_build_derived_key_token(env, derived_key, sec_node, 
asym_key_id, OXS_WSS_11_VALUE_TYPE_ENCRYPTED_KEY);  
+               /*now we can free the derived key*/
+               oxs_key_free(derived_key, env);
+               derived_key = NULL;
     }
 
     node_to_move = oxs_axiom_get_node_by_local_name(

Modified: webservices/rampart/trunk/c/src/util/rampart_handler_util.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/util/rampart_handler_util.c?rev=598903&r1=598902&r2=598903&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_handler_util.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_handler_util.c Wed Nov 28 
00:23:31 2007
@@ -174,6 +174,7 @@
 
     axis2_msg_ctx_set_fault_soap_envelope(msg_ctx, env, envelope);
     /*free sub codes*/
+       axutil_array_list_free(sub_codes, env);
     return;
 }
 

Modified: webservices/rampart/trunk/c/src/util/rampart_sec_header_builder.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/util/rampart_sec_header_builder.c?rev=598903&r1=598902&r2=598903&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_sec_header_builder.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_sec_header_builder.c Wed Nov 
28 00:23:31 2007
@@ -354,6 +354,7 @@
 
     sec_ns_obj =  axiom_namespace_create(env, RAMPART_WSSE_XMLNS,
                                          RAMPART_WSSE);
+       axiom_namespace_increment_ref(sec_ns_obj, env);
 
     sec_header_block = axiom_soap_header_add_header_block(soap_header,
                        env, RAMPART_SECURITY, sec_ns_obj);
@@ -361,6 +362,7 @@
     if(!sec_header_block)
     {
         AXIS2_LOG_INFO(env->log, "[rampart][shb] Security header block is 
NULL");
+               axiom_namespace_free(sec_ns_obj, env);
         return AXIS2_SUCCESS;
     }
 
@@ -387,6 +389,7 @@
         {
             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                             "[rampart][shb] Timestamp Token build failed. 
ERROR");
+                       axiom_namespace_free(sec_ns_obj, env);
             return AXIS2_FAILURE;
         }
     }
@@ -411,6 +414,7 @@
             {
                 AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                                 "[rampart][shb] UsernmaeToken build failed. 
ERROR");
+                               axiom_namespace_free(sec_ns_obj, env);
                 return AXIS2_FAILURE;
             }
         }
@@ -434,6 +438,7 @@
 
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart][shb] Asymmetric 
Binding. ");
         status = rampart_shb_do_asymmetric_binding(env, msg_ctx, 
rampart_context, soap_envelope, sec_node, sec_ns_obj);
+               axiom_namespace_free(sec_ns_obj, env);
         if(AXIS2_FAILURE == status){
             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart][shb] Asymmetric 
Binding failed");
             return AXIS2_FAILURE;
@@ -449,6 +454,7 @@
         /*Do Symmetric_binding specific things*/
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart][shb] Symmetric 
Binding. ");
         status = rampart_shb_do_symmetric_binding(env, msg_ctx, 
rampart_context, soap_envelope, sec_node, sec_ns_obj);
+               axiom_namespace_free(sec_ns_obj, env);
         if(AXIS2_FAILURE == status){
             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[rampart][shb] Symmetric 
Binding failed");
             return AXIS2_FAILURE;
@@ -459,8 +465,10 @@
     else if((rampart_context_get_binding_type(rampart_context,env)) == 
RP_PROPERTY_TRANSPORT_BINDING)
     {
         AXIS2_LOG_INFO(env->log, "[rampart][shb]  Using transport binding");
+               axiom_namespace_free(sec_ns_obj, env);
         return AXIS2_SUCCESS;
     }else{
+               axiom_namespace_free(sec_ns_obj, env);
         return AXIS2_FAILURE;
     }
 }

Modified: webservices/rampart/trunk/c/src/util/rampart_username_token.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/util/rampart_username_token.c?rev=598903&r1=598902&r2=598903&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_username_token.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_username_token.c Wed Nov 28 
00:23:31 2007
@@ -111,7 +111,6 @@
     }
 
     axiom_namespace_increment_ref(sec_ns_obj, env);
-    axiom_namespace_increment_ref(sec_ns_obj, env);
     ut_ele = axiom_element_create(env, sec_node,
                                   RAMPART_SECURITY_USERNAMETOKEN,
                                   sec_ns_obj,
@@ -150,7 +149,6 @@
             digest_val = rampart_crypto_sha1(env, nonce_val, created_val, 
password);
 
             axiom_namespace_increment_ref(sec_ns_obj, env);
-
             pw_ele = axiom_element_create(env, ut_node,
                                           
RAMPART_SECURITY_USERNAMETOKEN_PASSWORD, sec_ns_obj, &pw_node);
             if (pw_ele)
@@ -165,6 +163,7 @@
 
             }
 
+                       axiom_namespace_increment_ref(sec_ns_obj, env);
             nonce_ele = axiom_element_create(env, ut_node,
                                              
RAMPART_SECURITY_USERNAMETOKEN_NONCE, sec_ns_obj, &nonce_node);
             if (nonce_ele)
@@ -197,6 +196,7 @@
 
         else /*default is passwordText*/
         {
+                       axiom_namespace_increment_ref(sec_ns_obj, env);
             pw_ele = axiom_element_create(env, ut_node,
                                           
RAMPART_SECURITY_USERNAMETOKEN_PASSWORD, sec_ns_obj, &pw_node);
             if (pw_ele)

Modified: webservices/rampart/trunk/c/src/util/rampart_util.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/util/rampart_util.c?rev=598903&r1=598902&r2=598903&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_util.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_util.c Wed Nov 28 00:23:31 2007
@@ -158,7 +158,7 @@
         AXIS2_LOG_INFO(env->log, "[rampart][rampart_util] Unable to identify 
the callback module %s. ERROR", callback_module_name);
         if (param)
         {
-            AXIS2_FREE(env->allocator, param);
+                       axutil_param_free(param, env);
             param = NULL;
         }
         return AXIS2_FAILURE;


Reply via email to