Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

Commit

Permalink
Fix Valgrind complain
Browse files Browse the repository at this point in the history
Signed-off-by: Serhiy Stetskovych <[email protected]>
  • Loading branch information
patriotyk committed Nov 12, 2018
1 parent 97ccbbb commit b550165
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions src/libaktualizr/http/httpclient.cc
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,15 @@ void HttpClient::setCerts(const std::string& ca, CryptoSource ca_source, const s
}

HttpResponse HttpClient::post(const std::string& url, const Json::Value& data) {
curlEasySetoptWrapper(curl, CURLOPT_URL, url.c_str());
curlEasySetoptWrapper(curl, CURLOPT_POST, 1);
CURL* curl_post = curl_easy_duphandle(curl);
curlEasySetoptWrapper(curl_post, CURLOPT_URL, url.c_str());
curlEasySetoptWrapper(curl_post, CURLOPT_POST, 1);
std::string data_str = Json::FastWriter().write(data);
curlEasySetoptWrapper(curl, CURLOPT_POSTFIELDS, data_str.c_str());
curlEasySetoptWrapper(curl_post, CURLOPT_POSTFIELDS, data_str.c_str());
LOG_TRACE << "post request body:" << data;
return perform(curl, RETRY_TIMES, HttpInterface::kPostRespLimit);
auto result = perform(curl_post, RETRY_TIMES, HttpInterface::kPostRespLimit);
curl_easy_cleanup(curl_post);
return result;
}

HttpResponse HttpClient::put(const std::string& url, const Json::Value& data) {
Expand Down
2 changes: 1 addition & 1 deletion src/libaktualizr/primary/reportqueue.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void ReportQueue::flushQueue() {
// 404 implies the server does not support this feature. Nothing we can
// do, just move along.
if (response.isOk() || response.http_status_code == 404) {
report_array = Json::arrayValue;
report_array.clear();
}
}
}
Expand Down

0 comments on commit b550165

Please sign in to comment.