php-src/sapi
Niels Dossche fb3536fd60
Fix leak+crash with sapi_windows_set_ctrl_handler()
The ctrl_handler is never destroyed. We have to destroy it at request
end so we avoid leaking it and also avoid keeping a reference to
previous request memory in a next request. The latter can result in a
crash and can be demonstrated with this script and `--repeat 2`:

```php
class Test {
	public function set() {
		sapi_windows_set_ctrl_handler(self::cb(...));
	}
	public function cb() {
	}
}

$test = new Test;
$test->set();
sleep(3);
```
When you hit CTRL+C in the second request you can crash.

This patch resolves both the leak and crash by destroying the
ctrl_handler after a request.

Closes GH-18231.
2025-05-05 19:13:39 +02:00
..
apache2handler Implement GH-10854: TSRM should set a smarter value for expected_threads (#10867) 2023-03-17 17:08:47 +01:00
cgi Merge branch 'PHP-8.2' into PHP-8.3 2024-09-26 14:13:00 -05:00
cli Fix leak+crash with sapi_windows_set_ctrl_handler() 2025-05-05 19:13:39 +02:00
embed fix GH-8533: dynamic libphp linking on Mac 2025-03-12 07:40:02 +01:00
fpm Disable ZEND_RC_MOD_CHECK() while loading shared extension in FPM 2025-03-17 17:40:05 +01:00
fuzzer Fix GH-18082: Memory leaks in fuzzer SAPI error paths 2025-03-16 16:37:59 +01:00
litespeed Update LSAPI version to V8.2 2025-04-27 11:59:40 -04:00
phpdbg Fix memory leak in phpdbg calling registered function 2025-01-30 19:28:26 +01:00