Preserve key order when deleting, so context_reset will free last keys first.

This commit is contained in:
Hallvard Furuseth 2007-05-31 12:08:50 +00:00
parent 7c6b26a68f
commit 45389c0341

View File

@ -844,12 +844,8 @@ int ldap_pvt_thread_pool_getkey(
static void static void
clear_key_idx( ldap_int_thread_userctx_t *ctx, int i ) clear_key_idx( ldap_int_thread_userctx_t *ctx, int i )
{ {
int j = i; for ( ; i < MAXKEYS-1 && ctx->ltu_key[i+1].ltk_key; i++ )
while ( ++j < MAXKEYS && ctx->ltu_key[j].ltk_key ); ctx->ltu_key[i] = ctx->ltu_key[i+1];
if ( --j != i ) {
ctx->ltu_key[i] = ctx->ltu_key[j];
i = j;
}
ctx->ltu_key[i].ltk_key = NULL; ctx->ltu_key[i].ltk_key = NULL;
} }