I've committed changes to the ber_memfree and friends to ignore a NULL argument... I've also updated LDAP_MEMORY_DEBUG to code to detect duplicate ber_memfree() calls.