From: Howard Chu Date: Thu, 25 Jan 2007 11:53:09 +0000 (+0000) Subject: Calling setkey() with NULL data and kfree should erase the key. X-Git-Tag: OPENLDAP_REL_ENG_2_4_4ALPHA~8^2~139 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=977bd839cc07575fcd40593101f48ee9d8eeac0c;p=openldap Calling setkey() with NULL data and kfree should erase the key. --- diff --git a/libraries/libldap_r/tpool.c b/libraries/libldap_r/tpool.c index a6ba2062ba..72c056e234 100644 --- a/libraries/libldap_r/tpool.c +++ b/libraries/libldap_r/tpool.c @@ -826,9 +826,15 @@ int ldap_pvt_thread_pool_setkey( for ( i=0; iltu_key[i].ltk_key || ctx->ltu_key[i].ltk_key == key ) { - ctx->ltu_key[i].ltk_key = key; - ctx->ltu_key[i].ltk_data = data; - ctx->ltu_key[i].ltk_free = kfree; + if ( data || kfree ) { + ctx->ltu_key[i].ltk_key = key; + ctx->ltu_key[i].ltk_data = data; + ctx->ltu_key[i].ltk_free = kfree; + } else { + ctx->ltu_key[i].ltk_key = NULL; + ctx->ltu_key[i].ltk_data = NULL; + ctx->ltu_key[i].ltk_free = NULL; + } return 0; } } @@ -863,7 +869,7 @@ void ldap_pvt_thread_pool_purgekey( void *key ) /* * This is necessary if the caller does not have access to the * thread context handle (for example, a slapd plugin calling - * slapi_search_internal()). No doubt it is more efficient to + * slapi_search_internal()). No doubt it is more efficient * for the application to keep track of the thread context * handles itself. */