curl_mime_free.md (1347B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: curl_mime_free 5 Section: 3 6 Source: libcurl 7 See-also: 8 - curl_free (3) 9 - curl_mime_init (3) 10 Protocol: 11 - HTTP 12 - IMAP 13 - SMTP 14 Added-in: 7.56.0 15 --- 16 17 # NAME 18 19 curl_mime_free - free a previously built mime structure 20 21 # SYNOPSIS 22 23 ~~~c 24 #include <curl/curl.h> 25 26 void curl_mime_free(curl_mime *mime); 27 ~~~ 28 29 # DESCRIPTION 30 31 curl_mime_free(3) is used to clean up data previously built/appended 32 with curl_mime_addpart(3) and other mime-handling functions. This must 33 be called when the data has been used, which typically means after 34 curl_easy_perform(3) has been called. 35 36 The handle to free is the one you passed to the CURLOPT_MIMEPOST(3) 37 option: attached sub part mime structures must not be explicitly freed as they 38 are by the top structure freeing. 39 40 **mime** is the handle as returned from a previous call to 41 curl_mime_init(3) and may be NULL. 42 43 Passing in a NULL pointer in *mime* makes this function return immediately 44 with no action. 45 46 # %PROTOCOLS% 47 48 # EXAMPLE 49 50 ~~~c 51 int main(void) 52 { 53 CURL *curl = curl_easy_init(); 54 if(curl) { 55 /* Build the mime message. */ 56 curl_mime *mime = curl_mime_init(curl); 57 58 /* send off the transfer */ 59 60 /* Free multipart message. */ 61 curl_mime_free(mime); 62 } 63 } 64 ~~~ 65 66 # %AVAILABILITY% 67 68 # RETURN VALUE 69 70 None