From 23423cd0862faf38c9398e962ea9992534d74f91 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Mon, 18 Dec 2006 00:27:38 +0000 Subject: [PATCH] Fix callback handling --- servers/slapd/overlays/rwm.c | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/servers/slapd/overlays/rwm.c b/servers/slapd/overlays/rwm.c index 53882fb190..dc0d3fe120 100644 --- a/servers/slapd/overlays/rwm.c +++ b/servers/slapd/overlays/rwm.c @@ -42,16 +42,6 @@ typedef struct rwm_op_cb { rwm_op_state ros; } rwm_op_cb; -static rwm_op_cb rwm_cb; - -static void -rwm_keyfree( - void *key, - void *data ) -{ - ber_memfree_x( data, NULL ); -} - static int rwm_op_cleanup( Operation *op, SlapReply *rs ) { @@ -97,6 +87,8 @@ rwm_op_cleanup( Operation *op, SlapReply *rs ) break; default: break; } + op->o_callback = op->o_callback->sc_next; + op->o_tmpfree( cb, op->o_tmpmemctx ); } return SLAP_CB_CONTINUE; @@ -107,17 +99,7 @@ rwm_callback_get( Operation *op, SlapReply *rs ) { rwm_op_cb *roc = NULL; - if ( op->o_threadctx == NULL ) { - roc = &rwm_cb; - } else { - ldap_pvt_thread_pool_getkey( op->o_threadctx, - rwm_keyfree, (void *)&roc, NULL ); - if ( roc == NULL ) { - roc = ch_malloc( sizeof( struct rwm_op_cb )); - ldap_pvt_thread_pool_setkey( op->o_threadctx, - rwm_keyfree, roc, rwm_keyfree ); - } - } + roc = op->o_tmpalloc( sizeof( struct rwm_op_cb ), op->o_tmpmemctx ); roc->cb.sc_cleanup = rwm_op_cleanup; roc->cb.sc_response = NULL; roc->cb.sc_next = op->o_callback; -- 2.39.5