---
title: "es_copy_message(_:)"
framework: endpointsecurity
role: symbol
role_heading: Function
path: "endpointsecurity/es_copy_message(_:)"
---

# es_copy_message(_:)

Copies a message, by allocating new memory.

## Declaration

```swift
func es_copy_message(_ msg: UnsafePointer<es_message_t>) -> UnsafeMutablePointer<es_message_t>?
```

## Parameters

- `msg`: The message to copy.

## Return Value

Return Value A pointer to a copy of the original message.

## Discussion

Discussion After calling this function, the caller owns this memory and must eventually free it with es_free_message(_:) to avoid leaking memory.

## See Also

### Deprecated Functions

- [es_message_size(_:)](endpointsecurity/es_message_size(_:).md)
- [es_free_message(_:)](endpointsecurity/es_free_message(_:).md)
