From 95f6547963cb985010e49678cee702da3f1e2ff7 Mon Sep 17 00:00:00 2001 From: Hallvard Furuseth Date: Tue, 9 Mar 1999 05:56:13 +0000 Subject: [PATCH] Use free instead of ber_bvecfree to free privately malloced data, by JR Heisey --- clients/tools/ldapmodify.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/clients/tools/ldapmodify.c b/clients/tools/ldapmodify.c index 08db8c5912..1be272e08d 100644 --- a/clients/tools/ldapmodify.c +++ b/clients/tools/ldapmodify.c @@ -758,6 +758,32 @@ domodrdn( char *dn, char *newrdn, int deleteoldrdn ) +// for Windows we need local versions of the berval +// free functions because the LDAP DLL uses a different +// heap. + +static void +l_ber_bvfree( struct berval *bv ) +{ + if ( bv != NULL ) { + if ( bv->bv_val != NULL ) { + free( bv->bv_val ); + } + free( (char *) bv ); + } +} + +static void +l_ber_bvecfree( struct berval **bv ) +{ + int i; + + for ( i = 0; bv[i] != NULL; i++ ) { + l_ber_bvfree( bv[i] ); + } + free( (char *) bv ); +} + static void freepmods( LDAPMod **pmods ) { @@ -765,7 +791,7 @@ freepmods( LDAPMod **pmods ) for ( i = 0; pmods[ i ] != NULL; ++i ) { if ( pmods[ i ]->mod_bvalues != NULL ) { - ber_bvecfree( pmods[ i ]->mod_bvalues ); + l_ber_bvecfree( pmods[ i ]->mod_bvalues ); } if ( pmods[ i ]->mod_type != NULL ) { free( pmods[ i ]->mod_type ); -- 2.39.5