From be3f7eadaa79d008be2d776d5ff080164ef75055 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Tue, 1 Jun 1999 02:07:57 +0000 Subject: [PATCH] Update memory allocation calls. --- clients/tools/ldapmodify.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/clients/tools/ldapmodify.c b/clients/tools/ldapmodify.c index 3d3050b0c1..281ae52660 100644 --- a/clients/tools/ldapmodify.c +++ b/clients/tools/ldapmodify.c @@ -70,7 +70,8 @@ static char *read_one_record LDAP_P(( FILE *fp )); static void usage( const char *prog ) { - fprintf( stderr, "Add or modify entries from an LDAP server\n\n" + fprintf( stderr, + "Add or modify entries from an LDAP server\n\n" "usage: %s [-abcknrvF] [-d debug-level] [-P version] [-h ldaphost]\n" " [-p ldapport] [-D binddn] [-w passwd] [ -f file | < entryfile ]\n" " a - add values (default%s)\n" @@ -808,7 +809,7 @@ fromfile( char *path, struct berval *bv ) bv->bv_len = ftell( fp ); - if (( bv->bv_val = (char *)malloc( bv->bv_len )) == NULL ) { + if (( bv->bv_val = (char *)ber_memalloc( bv->bv_len )) == NULL ) { perror( "malloc" ); fclose( fp ); return( -1 ); @@ -817,6 +818,8 @@ fromfile( char *path, struct berval *bv ) if ( fseek( fp, 0L, SEEK_SET ) != 0 ) { perror( path ); fclose( fp ); + ber_memfree( bv->bv_val ); + bv->bv_val = NULL; return( -1 ); } @@ -826,7 +829,8 @@ fromfile( char *path, struct berval *bv ) if ( (unsigned long) rlen != bv->bv_len ) { perror( path ); - free( bv->bv_val ); + ber_memfree( bv->bv_val ); + bv->bv_val = NULL; return( -1 ); } -- 2.39.5