I create a variable curl_slist *header = NULL, and I want to reuse it.

*Error situation:*
*1st time:*
curl_slist_append(header, ...);
curl_easy_perform(curl);
curl_slist_free_all(header);

*reuse next time:*
curl_slist_append(header, ...);
curl_easy_perform(curl); // get segfault

*Correct situation:*
*1st time:*
curl_slist_append(header, ...);
curl_easy_perform(curl);
curl_slist_free_all(header);
*header = NULL; //add this line*

*reuse next time:*
curl_slist_append(header, ...);
curl_easy_perform(curl); // correct!

-- 
Best Regards,
pahome
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html

Reply via email to