[php-src] PR #20957: Fix memory leaks when sk_X509_new_null() fails
| From: | ndossche | Date: | Sat, 17 Jan 2026 11:44:05 +0000 |
| Subject: | [php-src] PR #20957: Fix memory leaks when sk_X509_new_null() fails | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-34588@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/20957
Author: ndossche
In a lot of places the return value is not checked, and when the function fails the code continues
execution. However, this means that operations on the stack fail and will cause memory leaks on the
objects that weren't pushed.
We also notice an inconsistency in how these failures are handled. For example, in one place we
explicitly have a fatal error
php_error_docref(NULL, E_ERROR, "Memory allocation
failure"); but this is the only place to do so.
This was found by a hybrid static-dynamic analysers that looks for inconsistent handling of error
checks in bindings.