You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rampart-dev@ws.apache.org by ma...@apache.org on 2007/08/20 13:36:37 UTC

svn commit: r567658 - in /webservices/rampart/trunk/c/src/omxmlsec: key.c key_mgr.c

Author: manjula
Date: Mon Aug 20 04:36:36 2007
New Revision: 567658

URL: http://svn.apache.org/viewvc?rev=567658&view=rev
Log:
Fixing memory leaks.

Modified:
    webservices/rampart/trunk/c/src/omxmlsec/key.c
    webservices/rampart/trunk/c/src/omxmlsec/key_mgr.c

Modified: webservices/rampart/trunk/c/src/omxmlsec/key.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/key.c?rev=567658&r1=567657&r2=567658&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/key.c (original)
+++ webservices/rampart/trunk/c/src/omxmlsec/key.c Mon Aug 20 04:36:36 2007
@@ -188,6 +188,9 @@
     status = oxs_key_populate(key, env,
                               oxs_buffer_get_data(buf, env), file_name,
                               oxs_buffer_get_size(buf, env), OXS_KEY_USAGE_NONE);
+    
+    oxs_buffer_free(buf, env);
+    buf = NULL;
 
     return status;
 
@@ -202,8 +205,6 @@
     openssl_cipher_property_t * cprop = NULL;
     axis2_status_t ret = AXIS2_FAILURE;
     int size;
-    unsigned char *temp_str = NULL;
-    int temp_int = 0;
 
     cprop = (openssl_cipher_property_t *)oxs_get_cipher_property_for_url(env, key_algo);
     if (!cprop)
@@ -225,13 +226,13 @@
         return AXIS2_FAILURE;
     }
 
-    temp_int = oxs_buffer_get_size(key_buf, env);
-    temp_str = oxs_buffer_get_data(key_buf, env);
 
     ret = oxs_key_populate(key, env,
                            oxs_buffer_get_data(key_buf, env), NULL,
                            oxs_buffer_get_size(key_buf, env), OXS_KEY_USAGE_NONE);
 
-    /* Duplicate key data and free key_buf*/
+    oxs_buffer_free(key_buf, env);
+    key_buf = NULL;    
+
     return ret;
 }

Modified: webservices/rampart/trunk/c/src/omxmlsec/key_mgr.c
URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/key_mgr.c?rev=567658&r1=567657&r2=567658&view=diff
==============================================================================
--- webservices/rampart/trunk/c/src/omxmlsec/key_mgr.c (original)
+++ webservices/rampart/trunk/c/src/omxmlsec/key_mgr.c Mon Aug 20 04:36:36 2007
@@ -235,6 +235,9 @@
         openssl_pkey_populate(open_pubkey, env, pubkey, openssl_x509_get_info(env, OPENSSL_X509_INFO_FINGER,cert), OPENSSL_PKEY_TYPE_PUBLIC_KEY);
         /*Set the public key to the x509 certificate*/
         oxs_x509_cert_set_public_key(oxs_cert, env, open_pubkey);
+    
+        X509_free(cert);
+        cert = NULL;
     }
 
     return oxs_cert;