]> git.sur5r.net Git - openldap/blobdiff - libraries/libldbm/ldbm.c
Fix the set_malloc/set_alloc fix.
[openldap] / libraries / libldbm / ldbm.c
index f10ff032f00b4f32067990a933fbfa1755780be2..03112e37f64b43f4778065c82e7cffb074f03333 100644 (file)
@@ -230,6 +230,10 @@ DB_ENV *ldbm_initialize_env(const char *home, int dbcachesize, int *envdirok)
                return NULL;
        }
 
+#if DB_VERSION_MINOR >= 3
+       env->set_alloc( env, ldbm_malloc, NULL, NULL );
+#endif
+
        env->set_errcall( env, ldbm_db_errcall );
        env->set_errpfx( env, "==>" );
        if (dbcachesize) {
@@ -312,14 +316,13 @@ ldbm_open( DB_ENV *env, char *name, int rw, int mode, int dbcachesize )
                return NULL;
        }
 
+#if DB_VERSION_MINOR < 3
+       ret->set_malloc( ret, ldbm_malloc );
+#endif
+
        ret->set_pagesize( ret, DEFAULT_DB_PAGE_SIZE );
 
        /* likely should use ber_mem* routines */
-#if DB_VERSION_MINOR >= 3
-       ret->set_alloc( ret, ldbm_malloc, NULL, NULL );
-#else
-       ret->set_malloc( ret, ldbm_malloc );
-#endif
 
        err = ret->open( ret, name, NULL, DB_TYPE, rw, mode);