httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject svn commit: r290459 - /httpd/httpd/trunk/modules/ssl/ssl_util.c
Date Tue, 20 Sep 2005 14:42:35 GMT
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;
 }
 



Mime
View raw message