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