Author: kaushalye Date: Thu Aug 23 03:35:30 2007 New Revision: 568922 URL: http://svn.apache.org/viewvc?rev=568922&view=rev Log: Memory leaks fixed
Modified: webservices/rampart/trunk/c/src/omxmlsec/encryption.c webservices/rampart/trunk/c/src/omxmlsec/iv.c webservices/rampart/trunk/c/src/omxmlsec/openssl/x509.c webservices/rampart/trunk/c/src/util/rampart_encryption.c Modified: webservices/rampart/trunk/c/src/omxmlsec/encryption.c URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/encryption.c?rev=568922&r1=568921&r2=568922&view=diff ============================================================================== --- webservices/rampart/trunk/c/src/omxmlsec/encryption.c (original) +++ webservices/rampart/trunk/c/src/omxmlsec/encryption.c Thu Aug 23 03:35:30 2007 @@ -45,17 +45,18 @@ axis2_status_t ret = AXIS2_FAILURE; /*Get cipher property*/ - cprop = oxs_get_cipher_property_for_url(env, oxs_ctx_get_enc_mtd_algorithm(enc_ctx, env)); + cprop = oxs_get_cipher_property_for_url(env, oxs_ctx_get_enc_mtd_algorithm(enc_ctx, env)); if(!cprop){ oxs_error(env, ERROR_LOCATION, OXS_ERROR_INVALID_DATA, "Cipher property is NULL"); return AXIS2_FAILURE; } /*Get the IV*/ - iv = axutil_strndup(env, - (axis2_char_t*)oxs_iv_generate_for_algo(env, - oxs_ctx_get_enc_mtd_algorithm(enc_ctx, env)), - openssl_cipher_property_get_iv_size(cprop, env)); + iv = axutil_strndup(env, + (axis2_char_t*)oxs_iv_generate_for_algo(env, + oxs_ctx_get_enc_mtd_algorithm(enc_ctx, env)), + openssl_cipher_property_get_iv_size(cprop, env)); + /*Create the openssl context*/ oc_ctx = openssl_cipher_ctx_create(env); Modified: webservices/rampart/trunk/c/src/omxmlsec/iv.c URL: http://svn.apache.org/viewvc/webservices/rampart/trunk/c/src/omxmlsec/iv.c?rev=568922&r1=568921&r2=568922&view=diff ============================================================================== --- webservices/rampart/trunk/c/src/omxmlsec/iv.c (original) +++ webservices/rampart/trunk/c/src/omxmlsec/iv.c Thu Aug 23 03:35:30 2007 @@ -57,7 +57,7 @@ } else { - iv = OXS_IV_DEFAULT;/* i.e. OPENSSL_DEFAULT_IV16. Many ciphers have 16... mmm.. need a better way.. a TODO*/ + iv = OXS_IV_DEFAULT; } return iv; 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=568922&r1=568921&r2=568922&view=diff ============================================================================== --- webservices/rampart/trunk/c/src/omxmlsec/openssl/x509.c (original) +++ webservices/rampart/trunk/c/src/omxmlsec/openssl/x509.c Thu Aug 23 03:35:30 2007 @@ -217,9 +217,9 @@ unformatted = NULL; core = NULL; return buffer; - } - else + }else{ return NULL; + } } @@ -231,9 +231,15 @@ int no = 0; /*WARN: Do not use the serial number without converting it to the integer.*/ serial = (axis2_char_t*)i2s_ASN1_INTEGER(NULL, X509_get_serialNumber(cert)); - no = atoi(serial); - - return no; + if(serial){ + no = atoi(serial); + + AXIS2_FREE(env->allocator, serial); + serial = NULL; + return no; + }else{ + return -1; + } } AXIS2_EXTERN unsigned long AXIS2_CALL @@ -379,10 +385,6 @@ result = axutil_strndup( env, data, n); BIO_free(out); - if(data){ - /*AXIS2_FREE(env->allocator, data); - data = NULL;*/ - } out = NULL; return result; 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=568922&r1=568921&r2=568922&view=diff ============================================================================== --- webservices/rampart/trunk/c/src/util/rampart_encryption.c (original) +++ webservices/rampart/trunk/c/src/util/rampart_encryption.c Thu Aug 23 03:35:30 2007 @@ -232,6 +232,11 @@ enc_ctx = NULL; }/*Eof For loop*/ + + /*TODO free list*/ + axutil_array_list_free(nodes_to_encrypt, env); + nodes_to_encrypt = NULL; + /*Get the asymmetric key encryption algorithm*/ enc_asym_algo = rampart_context_get_enc_asym_algo(rampart_context, env); @@ -331,6 +336,7 @@ { return AXIS2_FAILURE; } + oxs_asym_ctx_free(asym_ctx, env); asym_ctx = NULL;