From: Nikita Popov Date: Tue, 14 Apr 2020 14:05:57 +0000 (+0200) Subject: Don't leak peername if accept fails X-Git-Tag: php-7.3.18RC1~14 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b56fb9019e8d5eb6576d4ce254e01fe749ca0b92;p=php Don't leak peername if accept fails Even if the accept fails, the peername may be populated. --- diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c index 6fbfb0bcdc..493f3d0864 100644 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@ -295,6 +295,9 @@ PHP_FUNCTION(stream_socket_accept) } php_stream_to_zval(clistream, return_value); } else { + if (peername) { + zend_string_release(peername); + } php_error_docref(NULL, E_WARNING, "accept failed: %s", errstr ? ZSTR_VAL(errstr) : "Unknown error"); RETVAL_FALSE; }