curl_multi_cleanup(3)
β¨ NAME β¨
okay bestie, this is curl_multi_cleanup(3) β close down a multi session β straight outta the Library Functions Manual, and it's literally the final send-off for your whole multi stack π
πΈ SYNOPSIS πΈ
#include <curl/curl.h>
CURLMcode curl_multi_cleanup(CURLM *multi_handle);
π¦ DESCRIPTION π¦
okay so this function is the opposite of curl_multi_init(3). It cleans up and removes a whole multi stack. It does not free or touch any individual easy handles in any way β they still need to be closed individually, using the usual curl_easy_cleanup(3) way. do not skip that part, bestie.
The order of cleaning up should be:
curl_multi_remove_handle(3)before any easy handles are cleaned upcurl_easy_cleanup(3)can now be called independently since the easy handle is no longer connected to the multi handlecurl_multi_cleanup(3)should be called when all easy handles are removed
When this function is called, remaining entries in the connection pool held by the multi handle are shut down, which might trigger calls to the CURLMOPT_SOCKETFUNCTION(3) callback. so like, the callback might pop off β iykyk β¨
Passing in a NULL pointer in multi_handle makes this function return CURLM_BAD_HANDLE immediately with no other action.
Any use of the multi_handle after this function has been called and have returned, is illegal. periodt β that is not the vibe, do not do it π
π PROTOCOLS π
This functionality affects all supported protocols. all of them, no cap π«Ά
π EXAMPLE π
int main(void)
{
CURLM *multi = curl_multi_init();
/* when the multi transfer is done ... */
/* remove all easy handles, then: */
curl_multi_cleanup(multi);
}
β AVAILABILITY β
Added in curl 7.9.6. an oldie but a goodie π
π RETURN VALUE π
This function returns a CURLMcode indicating success or error.
CURLM_OK (0) means everything was OK, non-zero means an error occurred, see libcurl-errors(3).
π«Ά SEE ALSO π«Ά
xoxo, this page is from libcurl, dated 2026-10-12, for curl_multi_cleanup(3) β mwah, slay, bye bestie ππ
π¦ 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