diff options
author | Niklas Keller <me@kelunik.com> | 2018-08-03 21:00:14 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-06-21 12:54:30 +0200 |
commit | fea9f93166a31760679101269aee2326ee8185e9 (patch) | |
tree | 4fdc9591a6f856a436421c44258402ffb888f2e8 | |
parent | fcd6f2de60e1fc593fa301f3af42b871624946d9 (diff) | |
download | php-git-fea9f93166a31760679101269aee2326ee8185e9.tar.gz |
Fix memory leak in TLS matches_san_list
-rw-r--r-- | ext/openssl/xp_ssl.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c index 56e5348731..a423da6e74 100644 --- a/ext/openssl/xp_ssl.c +++ b/ext/openssl/xp_ssl.c @@ -426,6 +426,8 @@ static zend_bool php_openssl_matches_san_list(X509 *peer, const char *subject_na if (php_openssl_matches_wildcard_name(subject_name, (const char *)cert_name)) { OPENSSL_free(cert_name); + sk_GENERAL_NAME_pop_free(alt_names, GENERAL_NAME_free); + return 1; } OPENSSL_free(cert_name); @@ -438,6 +440,8 @@ static zend_bool php_openssl_matches_san_list(X509 *peer, const char *subject_na san->d.iPAddress->data[3] ); if (strcasecmp(subject_name, (const char*)ipbuffer) == 0) { + sk_GENERAL_NAME_pop_free(alt_names, GENERAL_NAME_free); + return 1; } } @@ -448,6 +452,8 @@ static zend_bool php_openssl_matches_san_list(X509 *peer, const char *subject_na } } + sk_GENERAL_NAME_pop_free(alt_names, GENERAL_NAME_free); + return 0; } /* }}} */ |