ITS#9995 ldapdelete: plug potential search leak

This commit is contained in:
Howard Chu 2023-02-02 15:03:51 +00:00 committed by Quanah Gibson-Mount
parent 3c284d26cd
commit 7f0e4ecdaa

View file

@ -389,7 +389,9 @@ more:;
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 );
@ -405,15 +407,14 @@ more:;
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 ) {
@ -424,7 +425,7 @@ more:;
if ( rc != LDAP_SUCCESS ) {
tool_perror( "ldap_delete", rc, NULL, NULL, NULL, NULL );
ber_memfree( dn );
return rc;
goto leave;
}
@ -436,6 +437,7 @@ more:;
}
}
leave:
ldap_msgfree( res );
if ( srch_rc == LDAP_SIZELIMIT_EXCEEDED ) {