diff options
author | Pierre Joye <pajoye@php.net> | 2006-05-26 00:32:07 +0000 |
---|---|---|
committer | Pierre Joye <pajoye@php.net> | 2006-05-26 00:32:07 +0000 |
commit | 59ddb749383034bb706432b7c379e2fdd01f9171 (patch) | |
tree | 374e4139f8c1c0a2f3996d24a16ecafd97e17ab8 | |
parent | b882f9f37e335e08bcc523cb1d6c90ed59544638 (diff) | |
download | php-git-59ddb749383034bb706432b7c379e2fdd01f9171.tar.gz |
- fix leaks in openssl context options
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | ext/openssl/xp_ssl.c | 7 |
2 files changed, 7 insertions, 1 deletions
@@ -44,6 +44,7 @@ PHP NEWS - Added pg_field_table() function. (Edin) - Added implementation of curl_multi_info_read(). (Brian) - Added RFC2397 (data: stream) support. (Marcus) +- Fixed memory leaks in openssl streams context options (Pierre) - Fixed handling of extremely long paths inside tempnam() function. (Ilia) - Fixed bug #37587 (var without attribute causes segfault). (Marcus) - Fixed bug #37569 (WDDX incorrectly encodes high-ascii characters). (Ilia) diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c index 4a5e302a41..504ae8bd4d 100644 --- a/ext/openssl/xp_ssl.c +++ b/ext/openssl/xp_ssl.c @@ -432,6 +432,7 @@ static inline int php_openssl_enable_crypto(php_stream *stream, "ssl", "peer_certificate", zcert); peer_cert = NULL; + efree(zcert); } if (SUCCESS == php_stream_context_get_option( @@ -445,7 +446,7 @@ static inline int php_openssl_enable_crypto(php_stream *stream, chain = SSL_get_peer_cert_chain( sslsock->ssl_handle); - if (chain) { + if (chain && sk_X509_num(chain) > 0) { int i; array_init(arr); @@ -458,6 +459,8 @@ static inline int php_openssl_enable_crypto(php_stream *stream, php_openssl_get_x509_list_id())); add_next_index_zval(arr, zcert); } + efree(zcert); + } else { ZVAL_NULL(arr); } @@ -465,6 +468,8 @@ static inline int php_openssl_enable_crypto(php_stream *stream, php_stream_context_set_option(stream->context, "ssl", "peer_certificate_chain", arr); + zval_dtor(arr); + efree(arr); } } } |