From 2298595ea3b398d6dd33af406965a24c297e87df Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Thu, 25 Jan 2007 11:13:15 +0000 Subject: [PATCH] Free thread keys in reverse order of allocation --- libraries/libldap_r/tpool.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/libraries/libldap_r/tpool.c b/libraries/libldap_r/tpool.c index d8a4f53ceb..a6ba2062ba 100644 --- a/libraries/libldap_r/tpool.c +++ b/libraries/libldap_r/tpool.c @@ -720,12 +720,7 @@ ldap_int_thread_pool_wrapper ( } } - for ( i=0; iltu_key[i].ltk_key; i++) { + for ( i=MAXKEYS-1; i>=0; i--) { + if ( !ctx->ltu_key[i].ltk_key ) + continue; if ( ctx->ltu_key[i].ltk_free ) ctx->ltu_key[i].ltk_free( ctx->ltu_key[i].ltk_key, ctx->ltu_key[i].ltk_data ); -- 2.39.5