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

openldap-2.0.7/servers/slapd/back-ldbm/init.c



Hello,

I was trying to run OpenLDAP as a service on Win2K and I was getting an
annoying message while trying to stop the service:

slapd.exe - Application Error 

The instruction at "0x0045587b" referenced memory at "0x00000018". The 
memory could not be "read". 

Click on OK to terminate the program 
Click on CANCEL to debug the program 

I could compile the package normally and start the service without problems, the only issue was about stopping the service.

The workaround for the problem was to include the following lines of code on openldap-2.0.7/servers/slapd/back-ldbm/init.c around line 176

int
ldbm_back_db_destroy(
    BackendDB	*be
)
{
	/* should free/destroy every in be_private */
	struct ldbminfo	*li = (struct ldbminfo *) be->be_private;

	// Modified by Fernando Lemos 27/03/2001
	// li value was always 0x00000000 resulting on an exception 
	// that the reason for this if() { }.  
	if (li == NULL) {
		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;
}

I guess this is only a workaround, the correction should be to control the value of the variable be, always keeping it with a consistent value.

What do you think about this ?

Great regards,
Luiz Malere