mirror of
https://github.com/php/php-src.git
synced 2025-01-10 21:14:37 +08:00
- MFB: fix leaks in openssl context options
This commit is contained in:
parent
f876597452
commit
1902e8973c
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user