<!--
{
  "availability" : [
    "macOS: 10.15.0 - 11.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "EndpointSecurity",
  "identifier" : "/documentation/EndpointSecurity/es_free_message(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Endpoint Security"
    ],
    "preciseIdentifier" : "c:@F@es_free_message"
  },
  "title" : "es_free_message(_:)"
}
-->

# es_free_message(_:)

Frees the memory allocated for the given message.

```
func es_free_message(_ msg: UnsafeMutablePointer<es_message_t>)
```

## Parameters

`msg`

The message to free.

## Discussion

Only free messages you explicitly copied with [`es_copy_message(_:)`](/documentation/EndpointSecurity/es_copy_message(_:)).

> Warning:
> Freeing a message from inside a handler block will cause your app to crash.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)