From bb6da1ee0edb4bbd7cadf08970a9e8ae6f766c6d Mon Sep 17 00:00:00 2001 From: David Carlier Date: Sat, 21 Feb 2026 03:42:36 +0000 Subject: [PATCH] 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. --- ext/pcntl/pcntl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ext/pcntl/pcntl.c b/ext/pcntl/pcntl.c index 2034ca80b05b8..32eae167c9f6b 100644 --- a/ext/pcntl/pcntl.c +++ b/ext/pcntl/pcntl.c @@ -1733,6 +1733,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(); }