[php-src] PR #22899: Fix mem leak when duphandle fails in curl_clone_obj

From: Date: Mon, 27 Jul 2026 09:48:59 +0000
Subject: [php-src] PR #22899: Fix mem leak when duphandle fails in curl_clone_obj
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-37291@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/22899 Author: Sjord Move init_curl_handle so that we don't leak memory if curl_easy_duphandle fails within curl_clone_obj. init_curl_handle allocates things, and curl_free_obj frees that again. But curl_free_obj does nothing if ch->cp is not set. In curl_clone_obj, do the allocation only once we have a valid cp, so that curl_free_obj actually deallocates the memory again. If curl_easy_duphandle fails we have not allocated anything and nothing is cleaned up. Same as https://github.com/php/php-src/pull/22894, but for PHP 8.4.

« previous php.git-pulls (#37291) next »