Commit 6b54920a authored by Ondřej Kuzník's avatar Ondřej Kuzník
Browse files

Merge branch 'its8039' into 'master'

ITS#8039 Free resinfo even if opcookie is the last owner

See merge request !474
parents 6f31d73d 79967dd7
Pipeline #4011 passed with stage
in 54 minutes and 59 seconds
...@@ -843,24 +843,27 @@ again: ...@@ -843,24 +843,27 @@ again:
static void free_resinfo( syncres *sr ) static void free_resinfo( syncres *sr )
{ {
syncres **st; syncres **st;
resinfo *ri = sr->s_info;
int freeit = 0; int freeit = 0;
ldap_pvt_thread_mutex_lock( &sr->s_info->ri_mutex );
ldap_pvt_thread_mutex_lock( &ri->ri_mutex );
for (st = &sr->s_info->ri_list; *st; st = &(*st)->s_rilist) { for (st = &sr->s_info->ri_list; *st; st = &(*st)->s_rilist) {
if (*st == sr) { if (*st == sr) {
*st = sr->s_rilist; *st = sr->s_rilist;
if ( !sr->s_info->ri_list )
freeit = 1;
sr->s_info = NULL;
break; break;
} }
} }
if ( !sr->s_info->ri_list ) ldap_pvt_thread_mutex_unlock( &ri->ri_mutex );
freeit = 1;
ldap_pvt_thread_mutex_unlock( &sr->s_info->ri_mutex );
if ( freeit ) { if ( freeit ) {
ldap_pvt_thread_mutex_destroy( &sr->s_info->ri_mutex ); ldap_pvt_thread_mutex_destroy( &ri->ri_mutex );
if ( sr->s_info->ri_e ) if ( ri->ri_e )
entry_free( sr->s_info->ri_e ); entry_free( ri->ri_e );
if ( !BER_BVISNULL( &sr->s_info->ri_cookie )) if ( !BER_BVISNULL( &ri->ri_cookie ))
ch_free( sr->s_info->ri_cookie.bv_val ); ch_free( ri->ri_cookie.bv_val );
ch_free( sr->s_info ); ch_free( ri );
} }
} }
...@@ -1544,6 +1547,10 @@ syncprov_op_cleanup( Operation *op, SlapReply *rs ) ...@@ -1544,6 +1547,10 @@ syncprov_op_cleanup( Operation *op, SlapReply *rs )
if ( !BER_BVISNULL( &opc->sdn )) if ( !BER_BVISNULL( &opc->sdn ))
op->o_tmpfree( opc->sdn.bv_val, op->o_tmpmemctx ); op->o_tmpfree( opc->sdn.bv_val, op->o_tmpmemctx );
op->o_callback = cb->sc_next; op->o_callback = cb->sc_next;
if ( opc->ssres.s_info ) {
free_resinfo( &opc->ssres );
}
op->o_tmpfree(cb, op->o_tmpmemctx); op->o_tmpfree(cb, op->o_tmpmemctx);
return 0; return 0;
......
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