---
name: "ares_free_hostent"
section: "3"
platform: "linux"
package: "c-ares"
version: "1.34.9-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/ares_free_hostent"
---

# ares\_free\_hostent(3)

Free host structure allocated by ares functions

## NAME

ares\_free\_hostent - Free host structure allocated by ares functions

## SYNOPSIS

```
#include <ares.h>
void ares_free_hostent(struct hostent *host)
```

## DESCRIPTION

The *ares\_free\_hostent* function frees a **struct hostent** allocated by one of the functions *[ares\_parse\_a\_reply(3)](/ares_parse_a_reply/3.md)*, *[ares\_parse\_aaaa\_reply(3)](/ares_parse_aaaa_reply/3.md)*, or *[ares\_parse\_ptr\_reply(3)](/ares_parse_ptr_reply/3.md)*.

## NOTES

It is not necessary (and is not correct) to free the host structure passed to the callback functions for *[ares\_gethostbyname(3)](/ares_gethostbyname/3.md)* or *[ares\_gethostbyaddr(3)](/ares_gethostbyaddr/3.md)*. c-ares will automatically free such host structures when the callback returns.

## SEE ALSO

[**ares\_parse\_a\_reply**(3)](/ares_parse_a_reply/3.md), [**ares\_parse\_aaaa\_reply**(3)](/ares_parse_aaaa_reply/3.md), [**ares\_parse\_ptr\_reply**(3)](/ares_parse_ptr_reply/3.md), [**ares\_parse\_ns\_reply**(3)](/ares_parse_ns_reply/3.md)
