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