xref: /aosp_15_r20/external/curl/docs/libcurl/curl_free.md (revision 6236dae45794135f37c4eb022389c904c8b0090d)
1*6236dae4SAndroid Build Coastguard Worker---
2*6236dae4SAndroid Build Coastguard Workerc: Copyright (C) Daniel Stenberg, <[email protected]>, et al.
3*6236dae4SAndroid Build Coastguard WorkerSPDX-License-Identifier: curl
4*6236dae4SAndroid Build Coastguard WorkerTitle: curl_free
5*6236dae4SAndroid Build Coastguard WorkerSection: 3
6*6236dae4SAndroid Build Coastguard WorkerSource: libcurl
7*6236dae4SAndroid Build Coastguard WorkerSee-also:
8*6236dae4SAndroid Build Coastguard Worker  - curl_easy_escape (3)
9*6236dae4SAndroid Build Coastguard Worker  - curl_easy_unescape (3)
10*6236dae4SAndroid Build Coastguard WorkerProtocol:
11*6236dae4SAndroid Build Coastguard Worker  - All
12*6236dae4SAndroid Build Coastguard WorkerAdded-in: 7.1
13*6236dae4SAndroid Build Coastguard Worker---
14*6236dae4SAndroid Build Coastguard Worker
15*6236dae4SAndroid Build Coastguard Worker# NAME
16*6236dae4SAndroid Build Coastguard Worker
17*6236dae4SAndroid Build Coastguard Workercurl_free - reclaim memory that has been obtained through a libcurl call
18*6236dae4SAndroid Build Coastguard Worker
19*6236dae4SAndroid Build Coastguard Worker# SYNOPSIS
20*6236dae4SAndroid Build Coastguard Worker
21*6236dae4SAndroid Build Coastguard Worker~~~c
22*6236dae4SAndroid Build Coastguard Worker#include <curl/curl.h>
23*6236dae4SAndroid Build Coastguard Worker
24*6236dae4SAndroid Build Coastguard Workervoid curl_free(void *ptr);
25*6236dae4SAndroid Build Coastguard Worker~~~
26*6236dae4SAndroid Build Coastguard Worker
27*6236dae4SAndroid Build Coastguard Worker# DESCRIPTION
28*6236dae4SAndroid Build Coastguard Worker
29*6236dae4SAndroid Build Coastguard Workercurl_free reclaims memory that has been obtained through a libcurl call. Use
30*6236dae4SAndroid Build Coastguard Workercurl_free(3) instead of free() to avoid anomalies that can result from
31*6236dae4SAndroid Build Coastguard Workerdifferences in memory management between your application and libcurl.
32*6236dae4SAndroid Build Coastguard Worker
33*6236dae4SAndroid Build Coastguard WorkerPassing in a NULL pointer in *ptr* makes this function return immediately
34*6236dae4SAndroid Build Coastguard Workerwith no action.
35*6236dae4SAndroid Build Coastguard Worker
36*6236dae4SAndroid Build Coastguard Worker# %PROTOCOLS%
37*6236dae4SAndroid Build Coastguard Worker
38*6236dae4SAndroid Build Coastguard Worker# EXAMPLE
39*6236dae4SAndroid Build Coastguard Worker
40*6236dae4SAndroid Build Coastguard Worker~~~c
41*6236dae4SAndroid Build Coastguard Workerint main(void)
42*6236dae4SAndroid Build Coastguard Worker{
43*6236dae4SAndroid Build Coastguard Worker  char *width = curl_getenv("COLUMNS");
44*6236dae4SAndroid Build Coastguard Worker  if(width) {
45*6236dae4SAndroid Build Coastguard Worker    /* it was set */
46*6236dae4SAndroid Build Coastguard Worker    curl_free(width);
47*6236dae4SAndroid Build Coastguard Worker  }
48*6236dae4SAndroid Build Coastguard Worker}
49*6236dae4SAndroid Build Coastguard Worker~~~
50*6236dae4SAndroid Build Coastguard Worker
51*6236dae4SAndroid Build Coastguard Worker# %AVAILABILITY%
52*6236dae4SAndroid Build Coastguard Worker
53*6236dae4SAndroid Build Coastguard Worker# RETURN VALUE
54*6236dae4SAndroid Build Coastguard Worker
55*6236dae4SAndroid Build Coastguard WorkerNone
56