Quoting Nick Kew : > Proposed patch below. > > [...snip...] > > --- apr_dbd.c (revision 390371) > +++ apr_dbd.c (working copy) > @@ -63,17 +63,32 @@ > } > #endif > > +static apr_status_t apr_dbd_term(void *ptr) > +{ > + /* set drivers to NULL so init can work again */ > + drivers = NULL; > + > + /* Everything else we need is handled by cleanups registered > + * when we created mutexes and loaded DSOs > + */ > + return APR_SUCCESS; > +} > + > APU_DECLARE(apr_status_t) apr_dbd_init(apr_pool_t *pool) > { > apr_status_t ret = APR_SUCCESS; > + > + if (drivers != NULL) { > + return APR_SUCCESS; > + } > drivers = apr_hash_make(pool); > + apr_pool_cleanup_register(pool, NULL, apr_dbd_term, > + apr_pool_cleanup_null); > > > #if APR_HAS_THREADS > ret = apr_thread_mutex_create(&mutex, APR_THREAD_MUTEX_DEFAULT, pool); > - apr_pool_cleanup_register(pool, mutex, > - CLEANUP_CAST apr_thread_mutex_destroy, > - apr_pool_cleanup_null); > + /* This already registers a pool cleanup */ > #endif > > #ifndef APR_DSO_BUILD Looks good to me. I see you also removed the explicit mutex cleanup - I never even noticed it was there before, but it was obviously a segfault waiting to happen. Nice! -- Bojan