Author: shankar
Date: Thu Feb 14 20:23:31 2008
New Revision: 627941

URL: http://svn.apache.org/viewvc?rev=627941&view=rev
Log:
memory leak fix in saml 

Modified:
    webservices/rampart/trunk/c/src/omxmlsec/saml/assertion.c
    webservices/rampart/trunk/c/src/omxmlsec/transforms_factory.c
    webservices/rampart/trunk/c/src/util/rampart_saml.c

Modified: webservices/rampart/trunk/c/src/omxmlsec/saml/assertion.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/saml/assertion.c?rev=627941&r1=627940&r2=627941&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/saml/assertion.c (original)
+++ webservices/rampart/trunk/c/src/omxmlsec/saml/assertion.c Thu Feb 14 
20:23:31 2008
@@ -236,20 +236,26 @@
                if (assertion->minor_version && assertion->issuer && 
                        assertion->issue_instant)
                {
+                       axis2_char_t *random_byte = NULL;
+                       axis2_char_t *serialised_date = NULL;
                        attr = axiom_attribute_create(env, SAML_MAJORVERSION, 
                                SAML_MAJOR_VERSION, NULL);
                        axiom_element_add_attribute(e, env, attr, n);
                        attr = axiom_attribute_create(env, SAML_MINORVERSION, 
                                assertion->minor_version, NULL);
                        axiom_element_add_attribute(e, env, attr, n);
+                       random_byte = saml_id_generate_random_bytes(env);
                        attr = axiom_attribute_create(env, SAML_ASSERTION_ID, 
-                               saml_id_generate_random_bytes(env), NULL);
+                               random_byte, NULL);
                        axiom_element_add_attribute(e, env, attr, n);
                        attr = axiom_attribute_create(env, SAML_ISSUER, 
assertion->issuer, NULL);
                        axiom_element_add_attribute(e, env, attr, n);
+                       serialised_date = 
axutil_date_time_serialize_date_time(assertion->issue_instant, env);
                        attr = axiom_attribute_create(env, SAML_ISSUE_INSTANT, 
-                               
axutil_date_time_serialize_date_time(assertion->issue_instant, env), NULL);
-                       axiom_element_add_attribute(e, env, attr, n);           
                                
+                               serialised_date, NULL);
+                       axiom_element_add_attribute(e, env, attr, n);
+                       AXIS2_FREE(env->allocator, random_byte);
+                       AXIS2_FREE(env->allocator, serialised_date);
                }               
                else
                {

Modified: webservices/rampart/trunk/c/src/omxmlsec/transforms_factory.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/transforms_factory.c?rev=627941&r1=627940&r2=627941&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/transforms_factory.c (original)
+++ webservices/rampart/trunk/c/src/omxmlsec/transforms_factory.c Thu Feb 14 
20:23:31 2008
@@ -113,6 +113,10 @@
 
     if (!embeded_qname || !key_qname)
     {
+               if(embeded_qname)
+                       axutil_qname_free(embeded_qname, env);
+               if(key_qname)
+                       axutil_qname_free(key_qname, env);
         return OXS_TRANSFORM_TYPE_UNKNOWN;
     }
 
@@ -142,12 +146,17 @@
                 }
                 else
                 {
+                                       axutil_qname_free(embeded_qname, env);
+                                       axutil_qname_free(key_qname, env);
                     oxs_error(env, ERROR_LOCATION, OXS_ERROR_TRANSFORM_FAILED, 
"Unrecognized reference type  NODE.");
                     return OXS_TRANSFORM_TYPE_UNKNOWN;   
                 }
             }
         }
     }
+
+       axutil_qname_free(embeded_qname, env);
+       axutil_qname_free(key_qname, env);
     if (node)
     {
         doc = axiom_node_get_document(node, env);

Modified: webservices/rampart/trunk/c/src/util/rampart_saml.c
URL: 
http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/util/rampart_saml.c?rev=627941&r1=627940&r2=627941&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/util/rampart_saml.c (original)
+++ webservices/rampart/trunk/c/src/util/rampart_saml.c Thu Feb 14 20:23:31 2008
@@ -104,7 +104,8 @@
     /* Sign the assertion, not the securitytokenreference */
     oxs_sign_part_set_node(sign_part, env, strn);
     oxs_sign_part_set_digest_mtd(sign_part, env, digest_method);
-        
+    
+       axutil_qname_free(qname, env);
     AXIS2_FREE(env->allocator, id);   
     return sign_part;
 }


Reply via email to