+ if ( !BER_BVISNULL( &op->o_dn ) ) {
+ ch_free( op->o_dn.bv_val );
+ }
+ if ( !BER_BVISNULL( &op->o_ndn ) ) {
+ ch_free( op->o_ndn.bv_val );
+ }
+ if ( !BER_BVISNULL( &op->o_authmech ) ) {
+ ch_free( op->o_authmech.bv_val );
+ }
+ if ( op->o_ctrls != NULL ) {
+ slap_free_ctrls( op, op->o_ctrls );
+ }
+
+#ifdef LDAP_CONNECTIONLESS
+ if ( op->o_res_ber != NULL ) {
+ ber_free( op->o_res_ber, 1 );
+ }
+#endif
+
+ {
+ GroupAssertion *g, *n;
+ for ( g = op->o_groups; g; g = n ) {
+ n = g->ga_next;
+ slap_sl_free( g, op->o_tmpmemctx );
+ }
+ op->o_groups = NULL;
+ }
+
+#if defined( LDAP_SLAPI )
+ if ( slapi_plugins_used ) {
+ slapi_int_free_object_extensions( SLAPI_X_EXT_OPERATION, op );
+ }
+#endif /* defined( LDAP_SLAPI ) */
+
+
+ memset( op, 0, sizeof(Operation) + sizeof(Opheader) + SLAP_MAX_CIDS * sizeof(void *) );
+ op->o_hdr = (Opheader *)(op+1);
+ op->o_controls = (void **)(op->o_hdr+1);
+
+ ldap_pvt_thread_mutex_lock( &slap_op_mutex );
+ LDAP_STAILQ_INSERT_HEAD( &slap_free_ops, op, o_next );
+ ldap_pvt_thread_mutex_unlock( &slap_op_mutex );