ber_tag_t oldtag = tag;
#endif /* SLAPD_MONITOR */
Connection *conn = op->o_conn;
- void *memctx;
+ void *memctx = NULL;
ber_len_t memsiz;
ldap_pvt_thread_mutex_lock( &num_ops_mutex );
op->o_tmpmemctx = memctx;
op->o_tmpmfuncs = &sl_mfuncs;
if ( tag != LDAP_REQ_ADD && tag != LDAP_REQ_MODIFY ) {
+ /* Note - the ber and its buffer are already allocated from
+ * regular memory; this only affects subsequent mallocs that
+ * ber_scanf may invoke.
+ */
ber_set_option( op->o_ber, LBER_OPT_BER_MEMCTX, memctx );
}
assert( LDAP_STAILQ_NEXT(op, o_next) == NULL );
if ( op->o_ber != NULL ) {
+ /* Note - the ber and its buffer are in regular memory,
+ * so make sure not to use sl_free here.
+ */
+ ber_set_option( op->o_ber, LBER_OPT_BER_MEMCTX, NULL );
ber_free( op->o_ber, 1 );
}
if ( op->o_dn.bv_val != NULL ) {