1
0
mirror of https://github.com/php/php-src.git synced 2026-04-20 14:31:06 +02:00
Files
archived-php-src/ext
Niels Dossche 8930bf8c33 Fix GH-8979: Possible Memory Leak with SSL-enabled MySQL connections
The stream context inside `mysqlnd_vio::enable_ssl()` is leaking.
In particular: when `php_stream_context_set()` get called the refcount
of `context` is increased by 1, which means that `context` will now
have a refcount of 2. Later on we remove the context from the stream
by calling `php_stream_context_set(stream, NULL)` but that leaves our
`context` with a refcount of 1, and therefore it's never destroyed.
In my test case this yielded a leak of 1456 bytes per connection
(but could be more depending on your settings ofc).

Annoyingly, Valgrind doesn't find it because the context is still
in the `EG(regular_list)` and will thus be destroyed at the end of
the request. However, I still think this bug needs to be fixed because
as the users in the issue report already mentioned:
there can be long-running PHP scripts.

Fix it by decreasing the refcount to transfer the ownership.

Closes GH-10909.
2023-03-24 18:03:29 +01:00
..
2022-06-25 07:39:55 +01:00
2023-03-24 10:10:17 +00:00
2022-07-27 12:13:32 +02:00
2023-02-12 21:33:39 -07:00
2023-03-01 23:02:03 +01:00
2022-09-13 11:33:09 +01:00
2022-04-25 14:29:44 +02:00
2022-09-27 23:32:15 +02:00
2022-06-13 14:43:51 +02:00
2022-08-31 14:22:44 +02:00
2022-12-18 23:20:29 -07:00
2023-03-15 01:35:01 +01:00
2022-10-13 16:00:36 +02:00
2023-03-01 23:02:03 +01:00
2023-03-13 12:36:59 +01:00
2022-06-15 15:39:00 +02:00