mirror of
https://github.com/apache/httpd.git
synced 2025-08-08 15:02:10 +03:00
Fix Bug#: 25659 (Memory leak in ssl_util_algotypeof())
Reported by David Blake in 2003, including patch. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@290459 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -137,10 +137,11 @@ BOOL ssl_util_path_check(ssl_pathcheck_t pcm, const char *path, apr_pool_t *p)
|
||||
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 @@ ssl_algo_t ssl_util_algotypeof(X509 *pCert, EVP_PKEY *pKey)
|
||||
break;
|
||||
}
|
||||
}
|
||||
#ifdef OPENSSL_VERSION_NUMBER
|
||||
/* Only refcounted in OpenSSL */
|
||||
if (pFreeKey != NULL)
|
||||
EVP_PKEY_free(pFreeKey);
|
||||
#endif
|
||||
return t;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user