mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-03-13 14:27:59 +08:00
Fix LBER_OPT_MEMCTX behavior
This commit is contained in:
parent
ac908e15e8
commit
5d0ba372e5
@ -211,7 +211,7 @@ ber_set_option(
|
||||
|
||||
case LBER_OPT_BER_MEMCTX:
|
||||
assert( LBER_VALID( ber ) );
|
||||
ber->ber_memctx = (void *)invalue;
|
||||
ber->ber_memctx = *(void **)invalue;
|
||||
return LBER_OPT_SUCCESS;
|
||||
|
||||
default:
|
||||
|
@ -934,7 +934,7 @@ connection_operation( void *ctx, void *arg_v )
|
||||
* regular memory; this only affects subsequent mallocs that
|
||||
* ber_scanf may invoke.
|
||||
*/
|
||||
ber_set_option( op->o_ber, LBER_OPT_BER_MEMCTX, memctx );
|
||||
ber_set_option( op->o_ber, LBER_OPT_BER_MEMCTX, &memctx );
|
||||
}
|
||||
|
||||
switch ( tag ) {
|
||||
@ -1088,7 +1088,8 @@ operations_error:
|
||||
|
||||
co_op_free:
|
||||
|
||||
ber_set_option( op->o_ber, LBER_OPT_BER_MEMCTX, NULL );
|
||||
memctx = NULL;
|
||||
ber_set_option( op->o_ber, LBER_OPT_BER_MEMCTX, &memctx );
|
||||
slap_op_free( op );
|
||||
|
||||
no_co_op_free:
|
||||
|
@ -45,10 +45,6 @@ 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 ) {
|
||||
|
@ -240,7 +240,7 @@ send_ldap_response(
|
||||
#endif
|
||||
{
|
||||
ber_init_w_nullc( ber, LBER_USE_DER );
|
||||
ber_set_option( ber, LBER_OPT_BER_MEMCTX, op->o_tmpmemctx );
|
||||
ber_set_option( ber, LBER_OPT_BER_MEMCTX, &op->o_tmpmemctx );
|
||||
}
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
@ -649,7 +649,7 @@ slap_send_search_entry( Operation *op, SlapReply *rs )
|
||||
bv.bv_val = op->o_tmpalloc(bv.bv_len, op->o_tmpmemctx );
|
||||
|
||||
ber_init2( ber, &bv, LBER_USE_DER );
|
||||
ber_set_option( ber, LBER_OPT_BER_MEMCTX, op->o_tmpmemctx );
|
||||
ber_set_option( ber, LBER_OPT_BER_MEMCTX, &op->o_tmpmemctx );
|
||||
}
|
||||
|
||||
#ifdef LDAP_CONNECTIONLESS
|
||||
@ -1297,7 +1297,7 @@ slap_send_search_reference( Operation *op, SlapReply *rs )
|
||||
#endif
|
||||
{
|
||||
ber_init_w_nullc( ber, LBER_USE_DER );
|
||||
ber_set_option( ber, LBER_OPT_BER_MEMCTX, op->o_tmpmemctx );
|
||||
ber_set_option( ber, LBER_OPT_BER_MEMCTX, &op->o_tmpmemctx );
|
||||
}
|
||||
|
||||
rc = ber_printf( ber, "{it{W}" /*"}"*/ , op->o_msgid,
|
||||
|
@ -44,7 +44,7 @@ str2filter_x( Operation *op, const char *str )
|
||||
|
||||
ber_init2( ber, NULL, LBER_USE_DER );
|
||||
if ( op->o_tmpmemctx ) {
|
||||
ber_set_option( ber, LBER_OPT_BER_MEMCTX, op->o_tmpmemctx );
|
||||
ber_set_option( ber, LBER_OPT_BER_MEMCTX, &op->o_tmpmemctx );
|
||||
}
|
||||
|
||||
rc = ldap_pvt_put_filter( ber, str );
|
||||
|
@ -386,7 +386,7 @@ do_syncrepl(
|
||||
|
||||
/* setup LDAP SYNC control */
|
||||
sync_ber = ber_alloc_t( LBER_USE_DER );
|
||||
ber_set_option( sync_ber, LBER_OPT_BER_MEMCTX, op.o_tmpmemctx );
|
||||
ber_set_option( sync_ber, LBER_OPT_BER_MEMCTX, &op.o_tmpmemctx );
|
||||
|
||||
if ( si->syncCookie ) {
|
||||
ber_printf( sync_ber, "{eO}", abs(si->type), si->syncCookie );
|
||||
@ -520,7 +520,7 @@ do_syncrepl(
|
||||
if ( rctrls ) {
|
||||
rctrlp = *rctrls;
|
||||
ctrl_ber = ber_alloc_t( LBER_USE_DER );
|
||||
ber_set_option( ctrl_ber, LBER_OPT_BER_MEMCTX, op.o_tmpmemctx );
|
||||
ber_set_option( ctrl_ber, LBER_OPT_BER_MEMCTX, &op.o_tmpmemctx );
|
||||
ber_write( ctrl_ber, rctrlp->ldctl_value.bv_val, rctrlp->ldctl_value.bv_len, 0 );
|
||||
ber_reset( ctrl_ber, 1 );
|
||||
|
||||
@ -787,7 +787,7 @@ syncrepl_message_to_entry(
|
||||
if ( rctrls ) {
|
||||
rctrlp = *rctrls;
|
||||
ctrl_ber = ber_alloc_t( LBER_USE_DER );
|
||||
ber_set_option( ctrl_ber, LBER_OPT_BER_MEMCTX, op->o_tmpmemctx );
|
||||
ber_set_option( ctrl_ber, LBER_OPT_BER_MEMCTX, &op->o_tmpmemctx );
|
||||
ber_write( ctrl_ber, rctrlp->ldctl_value.bv_val, rctrlp->ldctl_value.bv_len, 0 );
|
||||
ber_reset( ctrl_ber, 1 );
|
||||
ber_scanf( ctrl_ber, "{eo", syncstate, syncUUID );
|
||||
|
Loading…
x
Reference in New Issue
Block a user