LBER\_MEMORY(3) Library Functions Manual LBER\_MEMORY(3)

# [NAME](#NAME)

ber\_memalloc, ber\_memcalloc, ber\_memrealloc, ber\_memfree, ber\_memvfree - OpenLDAP LBER memory allocators

# [LIBRARY](#LIBRARY)

OpenLDAP LBER (liblber, -llber)

# [SYNOPSIS](#SYNOPSIS)

**#include &lt;lber.h&gt;**

**void \*ber\_memalloc(ber\_len\_t bytes);**

**void \*ber\_memcalloc(ber\_len\_t nelems, ber\_len\_t bytes);**

**void \*ber\_memrealloc(void \*ptr, ber\_len\_t bytes);**

**void ber\_memfree(void \*ptr);**

**void ber\_memvfree(void \*\*vec);**

# [DESCRIPTION](#DESCRIPTION)

These routines are used to allocate/deallocate memory used/returned by the Lightweight BER library as required by [**lber-encode**(3)](/man/os/openldap-2.7/lber-encode.3) and [**lber-decode**(3)](/man/os/openldap-2.7/lber-decode.3). **ber\_memalloc**(), **ber\_memcalloc**(), **ber\_memrealloc**(), and **ber\_memfree**() are used exactly like the standard [**malloc**(3)](/man/os/openldap-2.7/malloc.3), [**calloc**(3)](/man/os/openldap-2.7/calloc.3), [**realloc**(3)](/man/os/openldap-2.7/realloc.3), and [**free**(3)](/man/os/openldap-2.7/free.3) routines, respectively. The **ber\_memvfree**() routine is used to free a dynamically allocated array of pointers to arbitrary dynamically allocated objects.

# [SEE ALSO](#SEE_ALSO)

[**lber-decode**(3)](/man/os/openldap-2.7/lber-decode.3), [**lber-encode**(3)](/man/os/openldap-2.7/lber-encode.3), [**lber-types**(3)](/man/os/openldap-2.7/lber-types.3)

# [ACKNOWLEDGEMENTS](#ACKNOWLEDGEMENTS)

**OpenLDAP Software** is developed and maintained by The OpenLDAP Project &lt;http://www.openldap.org/&gt;. **OpenLDAP Software** is derived from the University of Michigan LDAP 3.3 Release.

2026/09/08 OpenLDAP 2.7.1

---

Document: lber-memory(3) from openldap-2.7 2.7.1-r1 (Chainguard OS)
Source: https://github.com/openldap/openldap.git
