diff --git a/NEWS b/NEWS index 22b1a57967447..57e947cf59fbd 100644 --- a/NEWS +++ b/NEWS @@ -30,6 +30,9 @@ PHP NEWS - Posix: . Fix memory leak in posix_ttyname() (girgias) +- Random: + . Fixed bug GH-10247 (Theoretical file descriptor leak for /dev/urandom). (timwolla) + - Standard: . Fix GH-10187 (Segfault in stripslashes() with arm64). (nielsdos) diff --git a/ext/random/random.c b/ext/random/random.c index 161eb8e685203..64e30e5087186 100644 --- a/ext/random/random.c +++ b/ext/random/random.c @@ -828,7 +828,7 @@ static PHP_GINIT_FUNCTION(random) /* {{{ PHP_GSHUTDOWN_FUNCTION */ static PHP_GSHUTDOWN_FUNCTION(random) { - if (random_globals->random_fd > 0) { + if (random_globals->random_fd >= 0) { close(random_globals->random_fd); random_globals->random_fd = -1; }