void
ber_free( BerElement *ber, int freebuf )
{
-#ifdef LDAP_MEMORY_DEBUG
- assert( ber != NULL );
-#endif
-
if( ber == NULL ) {
+ LDAP_MEMORY_DEBUG_ASSERT( ber != NULL );
return;
}
#ifdef LDAP_MEMORY_DEBUG
LBER_V (long) ber_int_meminuse;
#endif
+#if defined(LDAP_MEMORY_DEBUG) && ((LDAP_MEMORY_DEBUG +0) & 2)
+# define LDAP_MEMORY_DEBUG_ASSERT assert
+#else
+# define LDAP_MEMORY_DEBUG_ASSERT(expr) ((void) 0)
+#endif
struct lber_options {
short lbo_valid;
/*
* LDAP_MEMORY_DEBUG should only be enabled for the purposes of
* debugging memory management within OpenLDAP libraries and slapd.
- * It should only be enabled by an experienced developer as it
- * causes the inclusion of numerous assert()'s, many of which may
- * be triggered by a prefectly valid program.
+ *
+ * It should only be enabled by an experienced developer as it causes
+ * the inclusion of numerous assert()'s, many of which may be triggered
+ * by a prefectly valid program. If LDAP_MEMORY_DEBUG & 2 is true,
+ * that includes asserts known to break both slapd and current clients.
*
* The code behind this macro is subject to change as needed to
* support this testing.
{
void *new;
-#ifdef LDAP_MEMORY_DEBUG
- assert( s != 0 );
-#endif
-
if( s == 0 ) {
+ LDAP_MEMORY_DEBUG_ASSERT( s != 0 );
return NULL;
}
{
void *new;
-#ifdef LDAP_MEMORY_DEBUG
- assert( n != 0 && s != 0);
-#endif
-
if( n == 0 || s == 0 ) {
+ LDAP_MEMORY_DEBUG_ASSERT( n != 0 && s != 0);
return NULL;
}
void
ldap_control_free( LDAPControl *c )
{
-#ifdef LDAP_MEMORY_DEBUG
- assert( c != NULL );
-#endif
+ LDAP_MEMORY_DEBUG_ASSERT( c != NULL );
if ( c != NULL ) {
if( c->ldctl_oid != NULL) {
void
ldap_controls_free( LDAPControl **controls )
{
-#ifdef LDAP_MEMORY_DEBUG
- assert( controls != NULL );
-#endif
+ LDAP_MEMORY_DEBUG_ASSERT( controls != NULL );
if ( controls != NULL ) {
int i;