1curl_easy_cleanup(3) libcurl Manual curl_easy_cleanup(3)
2
3
4
6 curl_easy_cleanup - End a libcurl easy handle
7
9 #include <curl/curl.h>
10
11 void curl_easy_cleanup(CURL *handle);
12
14 This function must be the last function to call for an easy session. It
15 is the opposite of the curl_easy_init(3) function and must be called
16 with the same handle as input that a curl_easy_init(3) call returned.
17
18 This might close all connections this handle has used and possibly has
19 kept open until now - unless it was attached to a multi handle while
20 doing the transfers. Don't call this function if you intend to transfer
21 more files, re-using handles is a key to good performance with libcurl.
22
23 Occasionally you may get your progress callback or header callback
24 called from within curl_easy_cleanup(3) (if previously set for the han‐
25 dle using curl_easy_setopt(3)). Like if libcurl decides to shut down
26 the connection and the protocol is of a kind that requires a com‐
27 mand/response sequence before disconnect. Examples of such protocols
28 are FTP, POP3 and IMAP.
29
30 Any use of the handle after this function has been called and have
31 returned, is illegal. curl_easy_cleanup(3) kills the handle and all
32 memory associated with it!
33
34 Passing in a NULL pointer in handle will make this function return
35 immediately with no action.
36
38 For libcurl versions before 7.17,: after you've called this function,
39 you can safely remove all the strings you've previously told libcurl to
40 use, as it won't use them anymore now.
41
43 None
44
46 CURL *curl = curl_easy_init();
47 if(curl) {
48 CURLcode res;
49 curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
50 res = curl_easy_perform(curl);
51 curl_easy_cleanup(curl);
52 }
53
55 curl_easy_init(3), curl_easy_duphandle(3), curl_easy_reset(3),
56 curl_multi_cleanup(3), curl_multi_remove_handle(3)
57
58
59
60libcurl 7.64.0 August 09, 2018 curl_easy_cleanup(3)