Skip to content

Commit b56fb90

Browse files
committed
Don't leak peername if accept fails
Even if the accept fails, the peername may be populated.
1 parent a1b46fc commit b56fb90

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

ext/standard/streamsfuncs.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,9 @@ PHP_FUNCTION(stream_socket_accept)
295295
}
296296
php_stream_to_zval(clistream, return_value);
297297
} else {
298+
if (peername) {
299+
zend_string_release(peername);
300+
}
298301
php_error_docref(NULL, E_WARNING, "accept failed: %s", errstr ? ZSTR_VAL(errstr) : "Unknown error");
299302
RETVAL_FALSE;
300303
}

0 commit comments

Comments
 (0)