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

# [NAME](#NAME)

ldap\_memfree, ldap\_memvfree, ldap\_memalloc, ldap\_memcalloc, ldap\_memrealloc, ldap\_strdup - LDAP memory allocation routines

# [LIBRARY](#LIBRARY)

OpenLDAP LDAP (libldap, -lldap)

# [SYNOPSIS](#SYNOPSIS)

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

**void ldap\_memfree(void \*p);**

**void ldap\_memvfree(void \*\*v);**

**void \*ldap\_memalloc(ber\_len\_t s);**

**void \*ldap\_memcalloc(ber\_len\_t n, ber\_len\_t s);**

**void \*ldap\_memrealloc(void \*p, ber\_len\_t s);**

**char \*ldap\_strdup(LDAP\_CONST char \*p);**

# [DESCRIPTION](#DESCRIPTION)

These routines are used to allocate/deallocate memory used/returned by the LDAP library. **ldap\_memalloc**(), **ldap\_memcalloc**(), **ldap\_memrealloc**(), and **ldap\_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 **ldap\_memvfree**() routine is used to free a dynamically allocated array of pointers to arbitrary dynamically allocated objects. The **ldap\_strdup**() routine is used exactly like the standard [**strdup**(3)](/man/os/openldap-2.7/strdup.3) routine.

# [SEE ALSO](#SEE_ALSO)

[**ldap**(3)](/man/os/openldap-2.7/ldap.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/10/21 OpenLDAP 2.7.2

---

Document: ldap_memory(3) from openldap-2.7 2.7.2-r0 (Chainguard OS)
Source: https://github.com/openldap/openldap.git
