From: Hallvard Furuseth Date: Tue, 9 Mar 1999 05:56:13 +0000 (+0000) Subject: Use free instead of ber_bvecfree to free privately malloced data, by JR Heisey X-Git-Tag: OPENLDAP_SLAPD_BACK_LDAP~433 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=95f6547963cb985010e49678cee702da3f1e2ff7;p=openldap Use free instead of ber_bvecfree to free privately malloced data, by JR Heisey --- 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 );