---
name: "mac_free"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/mac_free"
---

# mac\_free(3)

free MAC label

## NAME

**mac\_free** – free MAC label

## LIBRARY

Standard C Library (libc, -lc)

## SYNOPSIS

**#include \<sys/mac.h\>**

*int*\

**mac\_free**(*mac\_t label*);

## DESCRIPTION

The **mac\_free**() function frees the storage allocated to contain a *mac\_t*.

## RETURN VALUES

The **mac\_free**() function always returns 0. WARNING: see the notes in the BUGS section regarding the use of this function.

## SEE ALSO

[mac(3)](/mac/3.md), [mac\_get(3)](/mac_get/3.md), [mac\_prepare(3)](/mac_prepare/3.md), [mac\_set(3)](/mac_set/3.md), [mac\_text(3)](/mac_text/3.md), [posix1e(3)](/posix1e/3.md), [mac(4)](/mac/4.md), [mac(9)](/mac/9.md)

## STANDARDS

POSIX.1e is described in IEEE POSIX.1e draft 17.

## HISTORY

Support for Mandatory Access Control was introduced in FreeBSD 5.0 as part of the TrustedBSD Project.

## BUGS

POSIX.1e specifies that **mac\_free**() will be used to free text strings created using [mac\_to\_text(3)](/mac_to_text/3.md). Because *mac\_t* is a complex structure in the TrustedBSD implementation, **mac\_free**() is specific to *mac\_t*, and must not be used to free the character strings returned from **mac\_to\_text**(). Doing so may result in undefined behavior.
