]> git.sur5r.net Git - openldap/commitdiff
mem cleanup (see ITS#6005) not worth chasing them all down
authorHoward Chu <hyc@openldap.org>
Sat, 7 Mar 2009 01:31:34 +0000 (01:31 +0000)
committerHoward Chu <hyc@openldap.org>
Sat, 7 Mar 2009 01:31:34 +0000 (01:31 +0000)
clients/tools/common.c
clients/tools/ldapsearch.c

index cb23ef41c2c272ea55431d85f28d3e4cdecbcc23..549a42536f9c952934df600c1eb2ea60573b7a03 100644 (file)
@@ -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" );
index 5d34c631599120943057d72b83c38724b88301c0..e10c9b33574c16ca79be8184f91aef4425d30e10 100644 (file)
@@ -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 */