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/enterprise-packages/openldap-2.5/malloc.3), [**calloc**(3)](/man/enterprise-packages/openldap-2.5/calloc.3), [**realloc**(3)](/man/enterprise-packages/openldap-2.5/realloc.3), and [**free**(3)](/man/enterprise-packages/openldap-2.5/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/enterprise-packages/openldap-2.5/strdup.3) routine.

# [SEE ALSO](#SEE_ALSO)

[**ldap**(3)](/man/enterprise-packages/openldap-2.5/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.

2025/05/22 OpenLDAP 2.5.20

---

Document: ldap_memory(3) from openldap-2.5 2.5.20-r6 (Chainguard OS)
Source: https://git.openldap.org/openldap/openldap.git
