mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-24 00:29:35 -05:00
Make LDAP_MEMORY_DEBUG a bitmask. #define LDAP_MEMORY_DEBUG_ASSERT. ITS#4990.
This commit is contained in:
parent
ea497ca60e
commit
973a2b41b7
4 changed files with 15 additions and 21 deletions
|
|
@ -204,11 +204,8 @@ ber_free_buf( BerElement *ber )
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,6 +47,11 @@ LBER_V (BER_ERRNO_FN) ber_int_errno_fn;
|
|||
#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;
|
||||
|
|
|
|||
|
|
@ -28,9 +28,11 @@
|
|||
/*
|
||||
* 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.
|
||||
|
|
@ -192,11 +194,8 @@ ber_memalloc_x( ber_len_t s, void *ctx )
|
|||
{
|
||||
void *new;
|
||||
|
||||
#ifdef LDAP_MEMORY_DEBUG
|
||||
assert( s != 0 );
|
||||
#endif
|
||||
|
||||
if( s == 0 ) {
|
||||
LDAP_MEMORY_DEBUG_ASSERT( s != 0 );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
@ -248,11 +247,8 @@ ber_memcalloc_x( ber_len_t n, ber_len_t s, void *ctx )
|
|||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -246,9 +246,7 @@ int ldap_pvt_get_controls(
|
|||
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) {
|
||||
|
|
@ -269,9 +267,7 @@ ldap_control_free( LDAPControl *c )
|
|||
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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue