break;
default:
tool_perror( "ldap_search", srch_rc, NULL, NULL, NULL, NULL );
- return( srch_rc );
+ rc = srch_rc;
+ srch_rc = 0;
+ goto leave;
}
entries = ldap_count_entries( ld, res );
if( dn == NULL ) {
ldap_get_option( ld, LDAP_OPT_RESULT_CODE, &rc );
tool_perror( "ldap_prune", rc, NULL, NULL, NULL, NULL );
- ber_memfree( dn );
- return rc;
+ goto leave;
}
rc = deletechildren( ld, dn, 0 );
if ( rc != LDAP_SUCCESS ) {
tool_perror( "ldap_prune", rc, NULL, NULL, NULL, NULL );
ber_memfree( dn );
- return rc;
+ goto leave;
}
if ( verbose ) {
if ( rc != LDAP_SUCCESS ) {
tool_perror( "ldap_delete", rc, NULL, NULL, NULL, NULL );
ber_memfree( dn );
- return rc;
+ goto leave;
}
}
}
+leave:
ldap_msgfree( res );
if ( srch_rc == LDAP_SIZELIMIT_EXCEEDED ) {