[Date Prev][Date Next] [Chronological] [Thread] [Top]

Memory access violation when stopping slapd. (ITS#870)



Full_Name: Jerzy Wirecki
Version: 2.0.6
OS: WinNT 4.0
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (135.90.24.1)


When stopping slapd on NT, ldbm_back_db_destroy() in module
servers\slapd\back-ldbm\init.c is called twice, the second time
trying to dereference a NULL pointer. Here is my fix:
==============================================================================

int
ldbm_back_db_destroy(
    BackendDB	*be
)
{
	/* should free/destroy every in be_private */
	struct ldbminfo	*li = (struct ldbminfo *) be->be_private;
	if(li == NULL)       // jwirecki
		return 0;    // jwirecki
	free( li->li_directory );
	attr_index_destroy( li->li_attrs );

	ldap_pvt_thread_mutex_destroy( &li->li_root_mutex );
	ldap_pvt_thread_mutex_destroy( &li->li_add_mutex );
	ldap_pvt_thread_mutex_destroy( &li->li_cache.c_mutex );
	ldap_pvt_thread_mutex_destroy( &li->li_nextid_mutex );
	ldap_pvt_thread_mutex_destroy( &li->li_dbcache_mutex );
	ldap_pvt_thread_cond_destroy( &li->li_dbcache_cv );

	free( be->be_private );
	be->be_private = NULL;

	return 0;
}