---
name: "curl_free"
section: "3"
platform: "linux"
package: "curl"
version: "8.23.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux", "macos"]
url: "https://new.carta.tech/curl_free"
---

# curl\_free(3)

reclaim memory that has been obtained through a libcurl call

## NAME

curl\_free - reclaim memory that has been obtained through a libcurl call

## SYNOPSIS

```
#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)](/curl_free/3.md)* 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

This functionality affects all supported protocols

## EXAMPLE

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

## AVAILABILITY

Added in curl 7.1

## RETURN VALUE

None

## SEE ALSO

[**curl\_easy\_escape**(3)](/curl_easy_escape/3.md), [**curl\_easy\_unescape**(3)](/curl_easy_unescape/3.md)
