curl_slist_free_all(3)
β¨ curl_slist_free_all(3) β¨
okay so bestie, this one's from the Library Functions Manual and it's lowkey the β¨cleanup queenβ¨ of the curl_slist world. Let's get into it π
πΈ NAME πΈ
curl_slist_free_all β free an entire curl_slist list π
π¦ SYNOPSIS π¦
#include <curl/curl.h>
void curl_slist_free_all(struct curl_slist *list);
π DESCRIPTION π
curl_slist_free_all() removes all traces of a previously built curl_slist linked list. like, it's giving full demolition, no crumbs left behind πβ¨
Passing in a NULL pointer in list makes this function return immediately with no action. so if you're like "hmm is my list even real," passing NULL is totally fine, it just shrugs and leaves π«Ά
Any use of the list after this function has been called and have returned, is illegal. π like fr fr, do NOT touch it afterwards. it's gone. periodt.
π PROTOCOLS π
This functionality affects all supported protocols π every single one, no cap.
π EXAMPLE π
int main(void)
{
CURL *handle = curl_easy_init();
struct curl_slist *slist = NULL;
slist = curl_slist_append(slist, "X-libcurl: coolness");
if(!slist)
return -1;
curl_easy_setopt(handle, CURLOPT_HTTPHEADER, slist);
curl_easy_perform(handle);
curl_slist_free_all(slist); /* free the list again */
}
see how she builds the list, uses it, and then frees the list again? that's the main character energy we love to see π β¨
β AVAILABILITY β
Added in curl 7.1 β an icon from way back, she's been slaying since forever π§
π₯ RETURN VALUE π₯
Nothing. literally nothing, it just does the thing and dips π
π¦ SEE ALSO π¦
curl_slist_append(3)β the bestie that builds the list in the first place π
libcurl π 2026-10-12 π curl_slist_free_all(3) β okay that's the whole page, go forth and free your lists responsibly bestie, mwah π«Άπ
π¦ where this page comes from
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms