Commit 2298595e authored by Howard Chu's avatar Howard Chu
Browse files

Free thread keys in reverse order of allocation

parent 2ec71598
......@@ -720,12 +720,7 @@ ldap_int_thread_pool_wrapper (
}
}
for ( i=0; i<MAXKEYS && uctx.ltu_key[i].ltk_key; i++ ) {
if (uctx.ltu_key[i].ltk_free)
uctx.ltu_key[i].ltk_free(
uctx.ltu_key[i].ltk_key,
uctx.ltu_key[i].ltk_data );
}
ldap_pvt_thread_pool_context_reset(&uctx);
thread_keys[keyslot].ctx = NULL;
thread_keys[keyslot].id = tid_zero;
......@@ -895,7 +890,9 @@ void ldap_pvt_thread_pool_context_reset( void *vctx )
ldap_int_thread_userctx_t *ctx = vctx;
int i;
for ( i=0; i<MAXKEYS && ctx->ltu_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 );
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment