Commit 6db389ef authored by Jong Hyuk Choi's avatar Jong Hyuk Choi
Browse files

further cleanup of search data upon exit, abandon, cancel

parent ca0bf91b
......@@ -429,6 +429,7 @@ bdb_db_destroy( BackendDB *be )
struct bdb_info *bdb = (struct bdb_info *) be->be_private;
Operation *ps = NULL;
Operation *psn = NULL;
void *saved_tmpmemctx = NULL;
/* close db environment */
if( bdb->bi_dbenv ) {
......@@ -467,17 +468,59 @@ bdb_db_destroy( BackendDB *be )
if ( ps ) {
psn = LDAP_LIST_NEXT( ps, o_ps_link );
saved_tmpmemctx = ps->o_tmpmemctx;
if (!BER_BVISNULL(&ps->o_req_dn)) {
slap_sl_free( ps->o_req_dn.bv_val, ps->o_tmpmemctx );
}
if (!BER_BVISNULL(&ps->o_req_ndn)) {
slap_sl_free( ps->o_req_ndn.bv_val, ps->o_tmpmemctx );
}
if (!BER_BVISNULL(&ps->ors_filterstr)) {
slap_sl_free(ps->ors_filterstr.bv_val, ps->o_tmpmemctx);
}
if (ps->ors_filter != NULL) {
filter_free_x(ps, ps->ors_filter);
}
if ( ps->ors_attrs != NULL) {
ps->o_tmpfree(ps->ors_attrs, ps->o_tmpmemctx);
}
slap_op_free( ps );
if ( ps->o_tmpmemctx )
slap_sl_mem_destroy( NULL, ps->o_tmpmemctx );
if ( saved_tmpmemctx ) {
slap_sl_mem_destroy( NULL, saved_tmpmemctx );
}
}
while ( psn ) {
ps = psn;
psn = LDAP_LIST_NEXT( ps, o_ps_link );
saved_tmpmemctx = ps->o_tmpmemctx;
if (!BER_BVISNULL(&ps->o_req_dn)) {
slap_sl_free( ps->o_req_dn.bv_val, ps->o_tmpmemctx );
}
if (!BER_BVISNULL(&ps->o_req_ndn)) {
slap_sl_free( ps->o_req_ndn.bv_val, ps->o_tmpmemctx );
}
if (!BER_BVISNULL(&ps->ors_filterstr)) {
slap_sl_free(ps->ors_filterstr.bv_val, ps->o_tmpmemctx);
}
if (ps->ors_filter != NULL) {
filter_free_x(ps, ps->ors_filter);
}
if ( ps->ors_attrs != NULL) {
ps->o_tmpfree(ps->ors_attrs, ps->o_tmpmemctx);
}
slap_op_free( ps );
if ( ps->o_tmpmemctx )
slap_sl_mem_destroy( NULL, ps->o_tmpmemctx );
if ( saved_tmpmemctx ) {
slap_sl_mem_destroy( NULL, saved_tmpmemctx );
}
}
ch_free( bdb );
......
......@@ -341,13 +341,34 @@ int
bdb_abandon( Operation *op, SlapReply *rs )
{
Operation *ps;
void *saved_tmpmemctx;
ps = bdb_drop_psearch( op, op->oq_abandon.rs_msgid );
if ( ps ) {
saved_tmpmemctx = ps->o_tmpmemctx;
if (!BER_BVISNULL(&ps->o_req_dn)) {
slap_sl_free(ps->o_req_dn.bv_val, ps->o_tmpmemctx );
}
if (!BER_BVISNULL(&ps->o_req_ndn)) {
slap_sl_free(ps->o_req_ndn.bv_val, ps->o_tmpmemctx );
}
if (!BER_BVISNULL(&ps->ors_filterstr)) {
ps->o_tmpfree(ps->ors_filterstr.bv_val, ps->o_tmpmemctx);
}
if (ps->ors_filter != NULL) {
filter_free_x(ps, ps->ors_filter);
}
if (ps->ors_attrs != NULL) {
ps->o_tmpfree(ps->ors_attrs, ps->o_tmpmemctx);
}
slap_op_free ( ps );
if ( ps->o_tmpmemctx ) {
slap_sl_mem_destroy( NULL, ps->o_tmpmemctx );
if ( saved_tmpmemctx ) {
slap_sl_mem_destroy( NULL, saved_tmpmemctx );
}
return LDAP_SUCCESS;
}
return LDAP_UNAVAILABLE;
......@@ -357,15 +378,37 @@ int
bdb_cancel( Operation *op, SlapReply *rs )
{
Operation *ps;
void *saved_tmpmemctx;
ps = bdb_drop_psearch( op, op->oq_cancel.rs_msgid );
if ( ps ) {
saved_tmpmemctx = ps->o_tmpmemctx;
rs->sr_err = LDAP_CANCELLED;
send_ldap_result( ps, rs );
if (!BER_BVISNULL(&ps->o_req_dn)) {
slap_sl_free(ps->o_req_dn.bv_val, ps->o_tmpmemctx );
}
if (!BER_BVISNULL(&ps->o_req_ndn)) {
slap_sl_free(ps->o_req_ndn.bv_val, ps->o_tmpmemctx );
}
if (!BER_BVISNULL(&ps->ors_filterstr)) {
ps->o_tmpfree(ps->ors_filterstr.bv_val, ps->o_tmpmemctx);
}
if (ps->ors_filter != NULL) {
filter_free_x(ps, ps->ors_filter);
}
if (ps->ors_attrs != NULL) {
ps->o_tmpfree(ps->ors_attrs, ps->o_tmpmemctx);
}
slap_op_free ( ps );
if ( ps->o_tmpmemctx ) {
slap_sl_mem_destroy( NULL, ps->o_tmpmemctx );
if ( saved_tmpmemctx ) {
slap_sl_mem_destroy( NULL, saved_tmpmemctx );
}
return LDAP_SUCCESS;
}
return LDAP_UNAVAILABLE;
......
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