From: Pierre Joye Date: Fri, 26 May 2006 01:48:25 +0000 (+0000) Subject: - MFB: fix leaks in openssl context options X-Git-Tag: BEFORE_NEW_OUTPUT_API~72 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1902e8973c8f76661502a40ac23f3a9e519905cf;p=php - MFB: fix leaks in openssl context options --- diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c index 4a5e302a41..b83db488f1 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,7 @@ 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 +467,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); } } }