From c223beb658174064d2d976e71582432dbba7adda Mon Sep 17 00:00:00 2001 From: JeiHO Date: Wed, 8 Jan 2025 12:04:15 -0600 Subject: [PATCH] When the execution fails, the cURL resource is not closed When the execution fails, the cURL resource is not closed, and no system resources are released. --- src/Client.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Client.php b/src/Client.php index 9822709..730b0c8 100644 --- a/src/Client.php +++ b/src/Client.php @@ -65,9 +65,12 @@ public function run(Request $request) : Response $info = (array) \curl_getinfo($handle); } if ($body === false) { + $error = \curl_error($handle); + $errno = \curl_errno($handle); + @\curl_close($handle); throw new RequestException( - \curl_error($handle), - \curl_errno($handle), + $error, + $errno, info: $info ); }