---
name: "libressl-OPENSSL_malloc"
section: "3"
platform: "linux"
package: "libressl"
version: "4.4.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/libressl-OPENSSL_malloc"
---

# libressl-OPENSSL\_malloc(3)

legacy OpenSSL memory allocation wrappers

## NAME

**OPENSSL\_malloc**, **OPENSSL\_free**, **OPENSSL\_strdup**, **CRYPTO\_malloc**, **CRYPTO\_free**, **CRYPTO\_strdup** – legacy OpenSSL memory allocation wrappers

## SYNOPSIS

Crypto Library (libcrypto, -lcrypto)

**#include \<openssl/crypto.h\>**

*void* *\**\

**OPENSSL\_malloc**(*size\_t num*);

*void*\

**OPENSSL\_free**(*void \*addr*);

*char* *\**\

**OPENSSL\_strdup**(*const char \*str*);

*void* *\**\

**CRYPTO\_malloc**(*size\_t num*, *const char \*file*, *int line*);

*void*\

**CRYPTO\_free**(*void \*str*, *const char \**, *int*);

*char* *\**\

**CRYPTO\_strdup**(*const char \*p*, *const char \*file*, *int line*);

## DESCRIPTION

Do not use any of the interfaces documented here in new code. They are provided purely for compatibility with legacy application code.

These functions are wrappers around the corresponding standard [malloc(3)](/malloc/3.md), [free(3)](/free/3.md), and [strdup(3)](/strdup/3.md) functions.

The **OPENSSL\_\***() functions are implemented as macros.

## RETURN VALUES

These functions return the same type and value as the corresponding standard functions.

## SEE ALSO

[crypto(3)](/crypto/3.md)

## HISTORY

**CRYPTO\_malloc**() and **CRYPTO\_free**() first appeared in SSLeay 0.6.4 and have been available since OpenBSD 2.4.

**OPENSSL\_malloc**() and **OPENSSL\_free**() first appeared in OpenSSL 0.9.6 and have been available since OpenBSD 2.9.

**CRYPTO\_strdup**() and **OPENSSL\_strdup**() first appeared in OpenSSL 0.9.8j and have been available since OpenBSD 4.5.

## CAVEATS

If interoperability with other implementations is required, memory returned by the library as bare pointers must be freed with **OPENSSL\_free**().
