You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ma...@apache.org on 2005/09/20 16:42:35 UTC
svn commit: r290459 - /httpd/httpd/trunk/modules/ssl/ssl_util.c
Author: martin
Date: Tue Sep 20 07:42:31 2005
New Revision: 290459
URL: http://svn.apache.org/viewcvs?rev=290459&view=rev
Log:
Fix Bug#: 25659 (Memory leak in ssl_util_algotypeof())
Reported by David Blake in 2003, including patch.
Modified:
httpd/httpd/trunk/modules/ssl/ssl_util.c
Modified: httpd/httpd/trunk/modules/ssl/ssl_util.c
URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/modules/ssl/ssl_util.c?rev=290459&r1=290458&r2=290459&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/ssl/ssl_util.c (original)
+++ httpd/httpd/trunk/modules/ssl/ssl_util.c Tue Sep 20 07:42:31 2005
@@ -137,10 +137,11 @@
ssl_algo_t ssl_util_algotypeof(X509 *pCert, EVP_PKEY *pKey)
{
ssl_algo_t t;
+ EVP_PKEY *pFreeKey = NULL;
t = SSL_ALGO_UNKNOWN;
if (pCert != NULL)
- pKey = X509_get_pubkey(pCert);
+ pFreeKey = pKey = X509_get_pubkey(pCert);
if (pKey != NULL) {
switch (EVP_PKEY_key_type(pKey)) {
case EVP_PKEY_RSA:
@@ -153,6 +154,11 @@
break;
}
}
+#ifdef OPENSSL_VERSION_NUMBER
+ /* Only refcounted in OpenSSL */
+ if (pFreeKey != NULL)
+ EVP_PKEY_free(pFreeKey);
+#endif
return t;
}