1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Merge branch 'PHP-8.3' into PHP-8.4

* PHP-8.3:
  Fix memory leak when curl_slist_append() fails
This commit is contained in:
Niels Dossche
2025-05-31 11:14:13 +02:00
2 changed files with 7 additions and 2 deletions

3
NEWS
View File

@@ -13,6 +13,9 @@ PHP NEWS
. Fixed GH-18695 (zend_ast_export() - float number is not preserved).
(Oleg Efimov)
- Curl:
. Fix memory leak when setting a list via curl_setopt fails. (nielsdos)
- Date:
. Fix leaks with multiple calls to DatePeriod iterator current(). (nielsdos)

View File

@@ -2166,12 +2166,14 @@ static zend_result _php_curl_setopt(php_curl *ch, zend_long option, zval *zvalue
ZEND_HASH_FOREACH_VAL(ph, current) {
ZVAL_DEREF(current);
val = zval_get_tmp_string(current, &tmp_val);
slist = curl_slist_append(slist, ZSTR_VAL(val));
struct curl_slist *new_slist = curl_slist_append(slist, ZSTR_VAL(val));
zend_tmp_string_release(tmp_val);
if (!slist) {
if (!new_slist) {
curl_slist_free_all(slist);
php_error_docref(NULL, E_WARNING, "Could not build curl_slist");
return FAILURE;
}
slist = new_slist;
} ZEND_HASH_FOREACH_END();
if (slist) {