mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
Added ber_free_buf()
This commit is contained in:
parent
e6d4c7dbcc
commit
fbc54d47d3
@ -406,6 +406,9 @@ ber_free LDAP_P((
|
||||
BerElement *ber,
|
||||
int freebuf ));
|
||||
|
||||
LBER_F( void )
|
||||
ber_free_buf LDAP_P(( BerElement *ber ));
|
||||
|
||||
LBER_F( int )
|
||||
ber_flush LDAP_P((
|
||||
Sockbuf *sb,
|
||||
|
@ -180,6 +180,25 @@ ber_realloc( BerElement *ber, ber_len_t len )
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
void
|
||||
ber_free_buf( BerElement *ber )
|
||||
{
|
||||
Seqorset *s, *next;
|
||||
|
||||
assert( LBER_VALID( ber ) );
|
||||
|
||||
if ( ber->ber_buf) LBER_FREE( ber->ber_buf );
|
||||
|
||||
for( s = ber->ber_sos ; s != NULL ; s = next ) {
|
||||
next = s->sos_next;
|
||||
LBER_FREE( s );
|
||||
}
|
||||
|
||||
ber->ber_buf = NULL;
|
||||
ber->ber_sos = NULL;
|
||||
ber->ber_valid = LBER_UNINITIALIZED;
|
||||
}
|
||||
|
||||
void
|
||||
ber_free( BerElement *ber, int freebuf )
|
||||
{
|
||||
@ -191,21 +210,8 @@ ber_free( BerElement *ber, int freebuf )
|
||||
return;
|
||||
}
|
||||
|
||||
assert( LBER_VALID( ber ) );
|
||||
|
||||
if ( freebuf ) {
|
||||
Seqorset *s, *next;
|
||||
LBER_FREE( ber->ber_buf );
|
||||
|
||||
for( s = ber->ber_sos ; s != NULL ; s = next ) {
|
||||
next = s->sos_next;
|
||||
LBER_FREE( s );
|
||||
}
|
||||
}
|
||||
|
||||
ber->ber_buf = NULL;
|
||||
ber->ber_sos = NULL;
|
||||
ber->ber_valid = LBER_UNINITIALIZED;
|
||||
if( freebuf )
|
||||
ber_free_buf( ber );
|
||||
|
||||
LBER_FREE( (char *) ber );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user