mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-30 13:30:57 +08:00
ITS#2549, init memctx to NULL. Also reset ber memctx to NULL when freeing.
This commit is contained in:
parent
1cc7b10b7a
commit
f7d7700b6e
@ -892,7 +892,7 @@ connection_operation( void *ctx, void *arg_v )
|
||||
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 );
|
||||
@ -930,6 +930,10 @@ connection_operation( void *ctx, void *arg_v )
|
||||
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 );
|
||||
}
|
||||
|
||||
|
@ -45,6 +45,10 @@ slap_op_free( Operation *op )
|
||||
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 ) {
|
||||
|
Loading…
Reference in New Issue
Block a user