summaryrefslogtreecommitdiff
path: root/docs/libcurl/curl_free.md
blob: c10ca28034c49a150666c635714de7e8bd1f2033 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
---
c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
SPDX-License-Identifier: curl
Title: curl_free
Section: 3
Source: libcurl
See-also:
  - curl_easy_escape (3)
  - curl_easy_unescape (3)
Protocol:
  - All
Added-in: 7.1
---

# NAME

curl_free - reclaim memory that has been obtained through a libcurl call

# SYNOPSIS

~~~c
#include <curl/curl.h>

void curl_free(void *ptr);
~~~

# DESCRIPTION

curl_free reclaims memory that has been obtained through a libcurl call. Use
curl_free(3) instead of free() to avoid anomalies that can result from
differences in memory management between your application and libcurl.

Passing in a NULL pointer in *ptr* makes this function return immediately
with no action.

# %PROTOCOLS%

# EXAMPLE

~~~c
int main(void)
{
  char *width = curl_getenv("COLUMNS");
  if(width) {
    /* it was set */
    curl_free(width);
  }
}
~~~

# %AVAILABILITY%

# RETURN VALUE

None