From 388d51fe2d6dcc5e2d812fb2007a4721d227463c Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Tue, 1 Jun 1999 19:05:07 +0000 Subject: [PATCH] Use ldap_mods_free() instead of local routine. More memory handling changes. Need to sort out how to deal with strdup(). --- clients/tools/ldapmodify.c | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/clients/tools/ldapmodify.c b/clients/tools/ldapmodify.c index 281ae52660..d07625afb0 100644 --- a/clients/tools/ldapmodify.c +++ b/clients/tools/ldapmodify.c @@ -63,7 +63,6 @@ static void addmodifyop LDAP_P(( LDAPMod ***pmodsp, int modop, char *attr, static int domodify LDAP_P(( char *dn, LDAPMod **pmods, int newentry )); static int dodelete LDAP_P(( char *dn )); static int domodrdn LDAP_P(( char *dn, char *newrdn, int deleteoldrdn )); -static void freepmods LDAP_P(( LDAPMod **pmods )); static int fromfile LDAP_P(( char *path, struct berval *bv )); static char *read_one_record LDAP_P(( FILE *fp )); @@ -461,7 +460,7 @@ process_ldif_rec( char *rbuf ) free( newrdn ); } if ( pmods != NULL ) { - freepmods( pmods ); + ldap_mods_free( pmods, 1 ); } return( rc ); @@ -567,7 +566,7 @@ process_ldapmod_rec( char *rbuf ) } if ( pmods != NULL ) { - freepmods( pmods ); + ldap_mods_free( pmods, 1 ); } if ( dn != NULL ) { free( dn ); @@ -770,25 +769,6 @@ domodrdn( char *dn, char *newrdn, int deleteoldrdn ) } - -static void -freepmods( LDAPMod **pmods ) -{ - int i; - - for ( i = 0; pmods[ i ] != NULL; ++i ) { - if ( pmods[ i ]->mod_bvalues != NULL ) { - ber_bvecfree( pmods[ i ]->mod_bvalues ); - } - if ( pmods[ i ]->mod_type != NULL ) { - free( pmods[ i ]->mod_type ); - } - free( pmods[ i ] ); - } - free( pmods ); -} - - static int fromfile( char *path, struct berval *bv ) { -- 2.39.5