]> git.sur5r.net Git - openldap/blobdiff - clients/tools/ldappasswd.c
ITS#6548,#7092 Unbind,cleanup before client exit.
[openldap] / clients / tools / ldappasswd.c
index 81e9c76c9526001aaf5aba0fa359a4a2b57dbcd3..1e350f153c7ce7d3b9c8de348ecc65775854f787 100644 (file)
@@ -313,7 +313,7 @@ main( int argc, char *argv[] )
                struct timeval  tv;
 
                if ( tool_check_abandon( ld, id ) ) {
-                       return LDAP_CANCELLED;
+                       tool_exit( ld, LDAP_CANCELLED );
                }
 
                tv.tv_sec = 0;
@@ -322,7 +322,7 @@ main( int argc, char *argv[] )
                rc = ldap_result( ld, LDAP_RES_ANY, LDAP_MSG_ALL, &tv, &res );
                if ( rc < 0 ) {
                        tool_perror( "ldap_result", rc, NULL, NULL, NULL, NULL );
-                       return rc;
+                       tool_exit( ld, rc );
                }
 
                if ( rc != 0 ) {
@@ -409,8 +409,5 @@ main( int argc, char *argv[] )
 
 done:
        /* disconnect from server */
-       if ( ld )
-               tool_unbind( ld ); 
-       tool_destroy();
-       return rc;
+       tool_exit( ld, rc ); 
 }