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