From: Hallvard Furuseth Date: Thu, 31 May 2007 12:08:50 +0000 (+0000) Subject: Preserve key order when deleting, so context_reset will free last keys first. X-Git-Tag: OPENLDAP_REL_ENG_2_4_MP~440 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=45389c03415c38fedcc6c5edbddd5831e6062f0e;p=openldap Preserve key order when deleting, so context_reset will free last keys first. --- diff --git a/libraries/libldap_r/tpool.c b/libraries/libldap_r/tpool.c index 7d6c3afdf6..ac4f791432 100644 --- a/libraries/libldap_r/tpool.c +++ b/libraries/libldap_r/tpool.c @@ -844,12 +844,8 @@ int ldap_pvt_thread_pool_getkey( static void clear_key_idx( ldap_int_thread_userctx_t *ctx, int i ) { - int j = i; - while ( ++j < MAXKEYS && ctx->ltu_key[j].ltk_key ); - if ( --j != i ) { - ctx->ltu_key[i] = ctx->ltu_key[j]; - i = j; - } + for ( ; i < MAXKEYS-1 && ctx->ltu_key[i+1].ltk_key; i++ ) + ctx->ltu_key[i] = ctx->ltu_key[i+1]; ctx->ltu_key[i].ltk_key = NULL; }