From 7029d640cbc7717b7c0d511e982002a3c1c313fc Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sat, 7 Mar 2009 01:31:34 +0000 Subject: [PATCH] mem cleanup (see ITS#6005) not worth chasing them all down --- clients/tools/common.c | 6 +++--- clients/tools/ldapsearch.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/clients/tools/common.c b/clients/tools/common.c index cb23ef41c2..549a42536f 100644 --- a/clients/tools/common.c +++ b/clients/tools/common.c @@ -647,7 +647,7 @@ tool_args( int argc, char **argv ) } } - tmpctrls = (LDAPControl *)realloc( unknown_ctrls, + tmpctrls = (LDAPControl *)ber_memrealloc( unknown_ctrls, (unknown_ctrls_num + 1)*sizeof( LDAPControl ) ); if ( tmpctrls == NULL ) { fprintf( stderr, "%s: no memory?\n", prog ); @@ -1193,7 +1193,7 @@ tool_conn_setup( int dont, void (*private_setup)( LDAP * ) ) for ( i = 0; hosts[ i ] != NULL; i++ ) /* count'em */ ; - tmp = (char **)realloc( urls, sizeof( char * ) * ( nurls + i + 1 ) ); + tmp = (char **)ber_memrealloc( urls, sizeof( char * ) * ( nurls + i + 1 ) ); if ( tmp == NULL ) { fprintf( stderr, "DNS SRV: out of memory?\n" ); @@ -1227,7 +1227,7 @@ dnssrv_free:; ber_memfree( domain ); } else { - tmp = (char **)realloc( urls, sizeof( char * ) * ( nurls + 2 ) ); + tmp = (char **)ber_memrealloc( urls, sizeof( char * ) * ( nurls + 2 ) ); if ( tmp == NULL ) { fprintf( stderr, "DNS SRV: out of memory?\n" ); diff --git a/clients/tools/ldapsearch.c b/clients/tools/ldapsearch.c index 5d34c63159..e10c9b3357 100644 --- a/clients/tools/ldapsearch.c +++ b/clients/tools/ldapsearch.c @@ -1034,8 +1034,8 @@ getNextPage: tool_server_controls( ld, c, i ); - ber_free( seber, 1 ); - ber_free( vrber, 1 ); + if ( seber ) ber_free( seber, 1 ); + if ( vrber ) ber_free( vrber, 1 ); /* step back to the original number of controls, so that * those set while parsing args are preserved */ -- 2.39.5