Skip to content

Commit bb6da1e

Browse files
committed
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.
1 parent 70b2761 commit bb6da1e

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

ext/pcntl/pcntl.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1733,6 +1733,7 @@ PHP_FUNCTION(pcntl_setcpuaffinity)
17331733

17341734
if (cpu < 0 || cpu >= maxcpus) {
17351735
zend_argument_value_error(2, "cpu id must be between 0 and " ZEND_ULONG_FMT " (" ZEND_LONG_FMT ")", maxcpus, cpu);
1736+
PCNTL_CPU_DESTROY(mask);
17361737
RETURN_THROWS();
17371738
}
17381739

0 commit comments

Comments
 (0)