ITS#8039 more cleanup

This commit is contained in:
Howard Chu 2015-02-03 10:13:55 +00:00
parent 9232232397
commit cb3952db4b

View File

@ -771,6 +771,7 @@ again:
static void free_resinfo( syncres *sr ) static void free_resinfo( syncres *sr )
{ {
syncres **st; syncres **st;
int freeit = 0;
ldap_pvt_thread_mutex_lock( &sr->s_info->ri_mutex ); ldap_pvt_thread_mutex_lock( &sr->s_info->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) {
@ -778,8 +779,10 @@ static void free_resinfo( syncres *sr )
break; break;
} }
} }
if ( !sr->s_info->ri_list )
freeit = 1;
ldap_pvt_thread_mutex_unlock( &sr->s_info->ri_mutex ); ldap_pvt_thread_mutex_unlock( &sr->s_info->ri_mutex );
if ( !sr->s_info->ri_list ) { if ( freeit ) {
ldap_pvt_thread_mutex_destroy( &sr->s_info->ri_mutex ); ldap_pvt_thread_mutex_destroy( &sr->s_info->ri_mutex );
if ( sr->s_info->ri_e ) if ( sr->s_info->ri_e )
entry_free( sr->s_info->ri_e ); entry_free( sr->s_info->ri_e );