curl\_slist\_free\_all(3) Library Functions Manual curl\_slist\_free\_all(3)

# [NAME](#NAME)

curl\_slist\_free\_all - free an entire curl\_slist list

# [SYNOPSIS](#SYNOPSIS)

```
#include <curl/curl.h>
void curl_slist_free_all(struct curl_slist *list);
```

# [DESCRIPTION](#DESCRIPTION)

curl\_slist\_free\_all() removes all traces of a previously built curl\_slist linked list.

Passing in a NULL pointer in *list* makes this function return immediately with no action.

Any use of the **list** after this function has been called and have returned, is illegal.

# [PROTOCOLS](#PROTOCOLS)

This functionality affects all supported protocols

# [EXAMPLE](#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 */
}
```

# [AVAILABILITY](#AVAILABILITY)

Added in curl 7.1

# [RETURN VALUE](#RETURN_VALUE)

Nothing.

# [SEE ALSO](#SEE_ALSO)

[**curl\_slist\_append**(3)](/man/os/curl/curl_slist_append.3)

2026-10-01 libcurl

---

Document: curl_slist_free_all(3) from curl 8.22.0-r4 (Chainguard OS)
Source: https://github.com/curl/curl.git
