com php-src: Fixed resource leak: ext/openssl/xp_ssl.c
| From: | Dmitry Stogov | Date: | Wed, 08 Apr 2015 20:37:05 +0000 |
| Subject: | com php-src: Fixed resource leak: ext/openssl/xp_ssl.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-86142@lists.php.net to get a copy of this message | ||
Commit: 5ba72e5f80d5bea2370f87e5968d1103cda8925c
Author: Dmitry Stogov <dmitry@zend.com> Wed, 8 Apr 2015 23:37:05 +0300
Parents: 851a219226e8088fc6f96674ce265c3de0e3921b
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=5ba72e5f80d5bea2370f87e5968d1103cda8925c
Log:
Fixed resource leak
Changed paths:
M ext/openssl/xp_ssl.c
Diff:
diff --git a/ext/openssl/xp_ssl.c b/ext/openssl/xp_ssl.c
index 5ae6084..f7f6219 100644
--- a/ext/openssl/xp_ssl.c
+++ b/ext/openssl/xp_ssl.c
@@ -2592,6 +2592,7 @@ php_stream *php_openssl_ssl_socket_factory(const char *proto, size_t protolen,
sslsock->method = STREAM_CRYPTO_METHOD_SSLv2_CLIENT;
#else
php_error_docref(NULL, E_WARNING, "SSLv2 support is not compiled into the OpenSSL library
against which PHP is linked");
+ php_stream_close(stream);
return NULL;
#endif
} else if (strncmp(proto, "sslv3", protolen) == 0) {
@@ -2600,6 +2601,7 @@ php_stream *php_openssl_ssl_socket_factory(const char *proto, size_t protolen,
sslsock->method = STREAM_CRYPTO_METHOD_SSLv3_CLIENT;
#else
php_error_docref(NULL, E_WARNING, "SSLv3 support is not compiled into the OpenSSL library
against which PHP is linked");
+ php_stream_close(stream);
return NULL;
#endif
} else if (strncmp(proto, "tls", protolen) == 0) {
@@ -2614,6 +2616,7 @@ php_stream *php_openssl_ssl_socket_factory(const char *proto, size_t protolen,
sslsock->method = STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT;
#else
php_error_docref(NULL, E_WARNING, "TLSv1.1 support is not compiled into the OpenSSL library
against which PHP is linked");
+ php_stream_close(stream);
return NULL;
#endif
} else if (strncmp(proto, "tlsv1.2", protolen) == 0) {
@@ -2622,6 +2625,7 @@ php_stream *php_openssl_ssl_socket_factory(const char *proto, size_t protolen,
sslsock->method = STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT;
#else
php_error_docref(NULL, E_WARNING, "TLSv1.2 support is not compiled into the OpenSSL library
against which PHP is linked");
+ php_stream_close(stream);
return NULL;
#endif
}