]> granicus.if.org Git - php/commitdiff
Merge branch 'PHP-7.4'
authorNikita Popov <nikita.ppv@gmail.com>
Tue, 14 Apr 2020 14:08:43 +0000 (16:08 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Tue, 14 Apr 2020 14:08:43 +0000 (16:08 +0200)
* PHP-7.4:
  Don't leak peername if accept fails

1  2 
ext/standard/streamsfuncs.c

index e8fd16d3dfc04da38fb802d5959f5749a8b87794,d7bacf5bd52c40a3902e4a74929eb44c4b0e78c9..e3e31a76cf701098a92d32dd54e1e9e1a00e89ba
@@@ -281,7 -283,10 +281,10 @@@ PHP_FUNCTION(stream_socket_accept
                }
                php_stream_to_zval(clistream, return_value);
        } else {
 -              php_error_docref(NULL, E_WARNING, "accept failed: %s", errstr ? ZSTR_VAL(errstr) : "Unknown error");
+               if (peername) {
+                       zend_string_release(peername);
+               }
 +              php_error_docref(NULL, E_WARNING, "Accept failed: %s", errstr ? ZSTR_VAL(errstr) : "Unknown error");
                RETVAL_FALSE;
        }