mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Fix double free when socket_accept fails
This commit is contained in:
parent
b4a2a9662b
commit
800cf5a20f
2 changed files with 12 additions and 1 deletions
|
@ -272,7 +272,6 @@ static int php_accept_connect(php_socket *in_sock, php_socket *out_sock, struct
|
|||
|
||||
if (IS_INVALID_SOCKET(out_sock)) {
|
||||
PHP_SOCKET_ERROR(out_sock, "unable to accept incoming connection", errno);
|
||||
efree(out_sock);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
12
ext/sockets/tests/socket_accept_failure.phpt
Normal file
12
ext/sockets/tests/socket_accept_failure.phpt
Normal file
|
@ -0,0 +1,12 @@
|
|||
--TEST--
|
||||
socket_accept() failure
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
|
||||
var_dump(socket_accept($socket));
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: socket_accept(): unable to accept incoming connection [%d]: %s in %s on line %d
|
||||
bool(false)
|
Loading…
Add table
Add a link
Reference in a new issue