[Date Prev][Date Next] [Chronological] [Thread] [Top]

ber_memfree debugging



ber_memfree() in liblber has an assertion on the memory to be freed.
Should this be there? It's bombing out on me because
ldap_str2attributetype() in libldap frees pointers regardless if they've
been used or not. free_oc() and friends also free pointers to optional
fields, so it needs ber_memfree(NULL) to work.

It looks to me like the assertion should happen within the #ifdef
LDAP_MEMORY_DEBUG block...

void
ber_memfree( void *p )
  {
      ber_int_options.lbo_valid = LBER_INITIALIZED;
      
         /* catch p == NULL when debugging */
        assert( p != NULL );
      
        /* ignore p == NULL when not debugging */
        if( p == NULL ) {
              return;
        }
      
        if( ber_int_memory_fns == NULL ) {
  #ifdef LDAP_MEMORY_DEBUG

...

  #endif


Bert Vermeulen
bert@biot.com