Commit fbc54d47 authored by Howard Chu's avatar Howard Chu
Browse files

Added ber_free_buf()

parent e6d4c7db
...@@ -406,6 +406,9 @@ ber_free LDAP_P(( ...@@ -406,6 +406,9 @@ ber_free LDAP_P((
BerElement *ber, BerElement *ber,
int freebuf )); int freebuf ));
LBER_F( void )
ber_free_buf LDAP_P(( BerElement *ber ));
LBER_F( int ) LBER_F( int )
ber_flush LDAP_P(( ber_flush LDAP_P((
Sockbuf *sb, Sockbuf *sb,
......
...@@ -181,31 +181,37 @@ ber_realloc( BerElement *ber, ber_len_t len ) ...@@ -181,31 +181,37 @@ ber_realloc( BerElement *ber, ber_len_t len )
} }
void void
ber_free( BerElement *ber, int freebuf ) ber_free_buf( BerElement *ber )
{ {
#ifdef LDAP_MEMORY_DEBUG Seqorset *s, *next;
assert( ber != NULL );
#endif
if( ber == NULL ) {
return;
}
assert( LBER_VALID( ber ) ); assert( LBER_VALID( ber ) );
if ( freebuf ) { if ( ber->ber_buf) LBER_FREE( ber->ber_buf );
Seqorset *s, *next;
LBER_FREE( ber->ber_buf );
for( s = ber->ber_sos ; s != NULL ; s = next ) { for( s = ber->ber_sos ; s != NULL ; s = next ) {
next = s->sos_next; next = s->sos_next;
LBER_FREE( s ); LBER_FREE( s );
}
} }
ber->ber_buf = NULL; ber->ber_buf = NULL;
ber->ber_sos = NULL; ber->ber_sos = NULL;
ber->ber_valid = LBER_UNINITIALIZED; ber->ber_valid = LBER_UNINITIALIZED;
}
void
ber_free( BerElement *ber, int freebuf )
{
#ifdef LDAP_MEMORY_DEBUG
assert( ber != NULL );
#endif
if( ber == NULL ) {
return;
}
if( freebuf )
ber_free_buf( ber );
LBER_FREE( (char *) ber ); LBER_FREE( (char *) ber );
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment