diff --git a/libraries/libldap/free.c b/libraries/libldap/free.c
index ebf2d623c5709b4321018c748883ecdd2e6e0df3..666e2d6842fb0a9a15bfc91ff5ec618c5791d458 100644
--- a/libraries/libldap/free.c
+++ b/libraries/libldap/free.c
@@ -21,6 +21,17 @@ static char copyright[] = "@(#) Copyright (c) 1994 The Regents of the University
 
 #include "ldap-int.h"
 
+/*
+ * C-API deallocator
+ */
+void
+ldap_memfree( void *p )
+{
+	if(p != NULL) {
+		free( p );
+	}
+}
+
 void
 ldap_getfilter_free( LDAPFiltDesc *lfdp )
 {