1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

ext/pcntl: Fix cpuset leak in pcntl_setcpuaffinity on out-of-range CPU ID

Add missing PCNTL_CPU_DESTROY(mask) call before RETURN_THROWS() when
the cpu id is out of range, matching the cleanup on other error paths.

close GH-21268
This commit is contained in:
David Carlier
2026-02-21 03:42:36 +00:00
parent e2a5909ba3
commit 37ce67f276
2 changed files with 3 additions and 0 deletions

2
NEWS
View File

@@ -44,6 +44,8 @@ PHP NEWS
- PCNTL:
. Fixed pcntl_setns() internal errors handling regarding errnos.
(David Carlier)
. Fixed cpuset leak in pcntl_setcpuaffinity on out-of-range CPU ID
on NetBSD/Solaris platforms. (David Carlier)
- PDO_PGSQL:
. Fixed bug GH-21055 (connection attribute status typo for GSS negotiation).

View File

@@ -1734,6 +1734,7 @@ PHP_FUNCTION(pcntl_setcpuaffinity)
if (cpu < 0 || cpu >= maxcpus) {
zend_argument_value_error(2, "cpu id must be between 0 and " ZEND_ULONG_FMT " (" ZEND_LONG_FMT ")", maxcpus, cpu);
PCNTL_CPU_DESTROY(mask);
RETURN_THROWS();
}