From 0aa709e2514218c5d06f43d3c2d557e640075462 Mon Sep 17 00:00:00 2001 From: Dranzd Viper Date: Tue, 1 Aug 2017 08:59:03 +0800 Subject: [PATCH] Fix issue #12, Call curl_close after curl_error --- src/RateRequest/Get.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/RateRequest/Get.php b/src/RateRequest/Get.php index 5840943..fce7869 100644 --- a/src/RateRequest/Get.php +++ b/src/RateRequest/Get.php @@ -16,10 +16,12 @@ class Get extends Adapter curl_setopt($ch, CURLOPT_CONNECTTIMEOUT_MS, $this->curlConnectTimeoutInMilliseconds); curl_setopt($ch, CURLOPT_TIMEOUT, $this->curlDownloadTimeoutInSeconds); $response = curl_exec($ch); - curl_close($ch); if ($response === false) { - throw new RequestException(curl_error($ch)); + $error = curl_error($ch); + curl_close($ch); + throw new RequestException($error); } + curl_close($ch); return $response; } }