added call to curl_slist_free_all()

This commit is contained in:
jcli
2016-10-13 14:18:57 -07:00
parent 5a6ffa5da7
commit aa0840af20

View File

@@ -66,6 +66,7 @@ int DialServer::sendCommand(
{
CURL *curl;
CURLcode res = CURLE_OK;
struct curl_slist *slist=NULL;
if (curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK)
{
@@ -86,7 +87,6 @@ int DialServer::sendCommand(
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, payload.size());
if( payload.size() )
{
struct curl_slist *slist=NULL;
slist = curl_slist_append(slist, "Expect:");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, slist);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload.c_str());
@@ -108,6 +108,7 @@ int DialServer::sendCommand(
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &responseBody);
res = curl_easy_perform(curl);
if (curl_slist!=NULL) curl_slist_free_all(slist);
curl_easy_cleanup(curl);
curl_global_cleanup();
return (res == CURLE_OK);