Reputation: 279
I have this code
struct curl_slist *pCURL_List = NULL;
pCURL_List = curl_slist_append(pCURL_List, "Content-type: application/x-amf");
curl_easy_setopt(m_pCURL, CURLOPT_HTTPHEADER, pCURL_List);
curl_easy_perform(m_pCURL);
and right after curl_easy_perform(m_pCURL);
I need to reset the headers (the first part of the code). If I do curl_slist_free_all(pCURL_List);
the next curl_easy_perform(m_pCURL);
crashes the program.
I sure have the other parameters, the program is quite big and everything works EXCEPT calls after these lines.
Also, when I said that I need to reset the headers, I mean that I'd like curl to set back the old default values of Content-type. If I do
pCURL_List = curl_slist_append(pCURL_List, "Content-type:");
afaik it will delete the "Content-type" header.
Upvotes: 1
Views: 581
Reputation: 36
For the crash, did you set CURLOPT_HTTPHEADER back to null before calling curl_easy_perform the second time? I'm thinking the list itself was freed but the CURL handle still has a pointer to the now invalid memory.
Upvotes: 2