]> git.sur5r.net Git - openldap/commitdiff
ITS#2423 plug some memleaks
authorHoward Chu <hyc@openldap.org>
Sun, 6 Apr 2003 00:48:48 +0000 (00:48 +0000)
committerHoward Chu <hyc@openldap.org>
Sun, 6 Apr 2003 00:48:48 +0000 (00:48 +0000)
clients/tools/common.c
clients/tools/ldapsearch.c

index d39b3d9bd8f9fe11067d5be1d58dfd509a41082a..526358d8f67ca5704520e0a658eeacd26029e7e8 100644 (file)
@@ -670,6 +670,7 @@ tool_bind( LDAP *ld )
                        sasl_mech, NULL, NULL,
                        sasl_flags, lutil_sasl_interact, defaults );
 
+               lutil_sasl_freedefs( defaults );
                if( rc != LDAP_SUCCESS ) {
                        ldap_perror( ld, "ldap_sasl_interactive_bind_s" );
                        exit( EXIT_FAILURE );
index 67beac471e0279102fcccb337d3abc356e82c3c0..83cae190b6d08beca75e7bfacae9e795f8343c01 100644 (file)
@@ -915,6 +915,8 @@ getNextPage:
 #endif
 
        ldap_unbind( ld );
+       sasl_done();
+       ldap_pvt_tls_destroy();
        return( rc );
 }
 
@@ -1120,6 +1122,7 @@ static int dosearch(
        }
 
 done:
+       ldap_msgfree( res );
 #ifdef LDAP_CONTROL_PAGEDRESULTS
        if ( pageSize != 0 ) { 
                npagedresponses = npagedresponses + nresponses;
@@ -1521,24 +1524,28 @@ static int print_result(
                fprintf( stderr, "%s (%d)\n", ldap_err2string(err), err );
        }
 
-       if( matcheddn && *matcheddn ) {
+       if( matcheddn ) {
+               if( *matcheddn ) {
                if( !ldif ) {
                        write_ldif( LDIF_PUT_VALUE,
                                "matchedDN", matcheddn, strlen(matcheddn) );
                } else {
                        fprintf( stderr, "Matched DN: %s\n", matcheddn );
                }
+               }
 
                ber_memfree( matcheddn );
        }
 
-       if( text && *text ) {
+       if( text ) {
+               if( *text ) {
                if( !ldif ) {
                        write_ldif( LDIF_PUT_TEXT, "text",
                                text, strlen(text) );
                } else {
                        fprintf( stderr, "Additional information: %s\n", text );
                }
+               }
 
                ber_memfree( text );
        }