]> git.sur5r.net Git - openldap/commitdiff
Preserve key order when deleting, so context_reset will free last keys first.
authorHallvard Furuseth <hallvard@openldap.org>
Thu, 31 May 2007 12:08:50 +0000 (12:08 +0000)
committerHallvard Furuseth <hallvard@openldap.org>
Thu, 31 May 2007 12:08:50 +0000 (12:08 +0000)
libraries/libldap_r/tpool.c

index 7d6c3afdf643dcd7befcaef9802488100c81b7a7..ac4f791432fdb688327e9664c9c8fd2346a24902 100644 (file)
@@ -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;
 }