• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1---
2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al.
3SPDX-License-Identifier: curl
4Title: curl_free
5Section: 3
6Source: libcurl
7See-also:
8  - curl_easy_escape (3)
9  - curl_easy_unescape (3)
10---
11
12# NAME
13
14curl_free - reclaim memory that has been obtained through a libcurl call
15
16# SYNOPSIS
17
18~~~c
19#include <curl/curl.h>
20
21void curl_free(void *ptr);
22~~~
23
24# DESCRIPTION
25
26curl_free reclaims memory that has been obtained through a libcurl call. Use
27curl_free(3) instead of free() to avoid anomalies that can result from
28differences in memory management between your application and libcurl.
29
30Passing in a NULL pointer in *ptr* makes this function return immediately
31with no action.
32
33# EXAMPLE
34
35~~~c
36int main(void)
37{
38  char *width = curl_getenv("COLUMNS");
39  if(width) {
40    /* it was set! */
41    curl_free(width);
42  }
43}
44~~~
45
46# AVAILABILITY
47
48Always
49
50# RETURN VALUE
51
52None
53