From 39cfdbe79bfa44ff094addc45924d4ba080192e0 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Wed, 12 Mar 2025 10:44:31 -0400 Subject: [PATCH] MT#59962 call_control: free cURL handle at the end Don't retrieve the result code from an already-freed object. Change-Id: Ief92d8529f634428b95fcfcfa702445275c6c74e Warned-by: Coverity --- apps/sbc/call_control/rest/RestParams.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/sbc/call_control/rest/RestParams.cpp b/apps/sbc/call_control/rest/RestParams.cpp index a600687d..e9e7516d 100644 --- a/apps/sbc/call_control/rest/RestParams.cpp +++ b/apps/sbc/call_control/rest/RestParams.cpp @@ -148,6 +148,9 @@ bool RestParams::get(const string &url, string &data) curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "REST-in-peace/0.1"); CURLcode res = curl_easy_perform(curl_handle); + long code = 0; + curl_easy_getinfo(curl_handle, CURLINFO_RESPONSE_CODE, &code); + curl_easy_cleanup(curl_handle); if (res != 0) { @@ -156,8 +159,6 @@ bool RestParams::get(const string &url, string &data) return false; } - long code = 0; - curl_easy_getinfo(curl_handle, CURLINFO_RESPONSE_CODE, &code); if ((code < 200) || (code > 299)) { DBG("non-ok response code when downloading data: %ld\n", code); return false;