Commit ed3167c9 authored by Rich Prohaska's avatar Rich Prohaska Committed by Yoni Fogel

fix some env leaks refs[t:2198]

git-svn-id: file:///svn/toku/tokudb@15973 c7de825b-a66e-492c-adef-691d508d4ae1
parent 722f0aea
...@@ -28,12 +28,16 @@ static DB_ENV *env; ...@@ -28,12 +28,16 @@ static DB_ENV *env;
static int mode = S_IRWXU+S_IRWXG+S_IRWXO; static int mode = S_IRWXU+S_IRWXG+S_IRWXO;
static void test_shutdown(void);
static void static void
setup (u_int32_t flags) { setup (u_int32_t flags) {
int r; int r;
system("rm -rf " ENVDIR); system("rm -rf " ENVDIR);
r=toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO); r=toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO);
CKERR(r); CKERR(r);
if (env)
test_shutdown();
r=db_env_create(&env, 0); r=db_env_create(&env, 0);
CKERR(r); CKERR(r);
env->set_errfile(env, stderr); env->set_errfile(env, stderr);
...@@ -47,12 +51,15 @@ static void ...@@ -47,12 +51,15 @@ static void
test_shutdown(void) { test_shutdown(void) {
int r; int r;
r=env->close(env, 0); CKERR(r); r=env->close(env, 0); CKERR(r);
env = NULL;
} }
static void static void
reopen_env(u_int32_t flags, int expected_r) { reopen_env(u_int32_t flags, int expected_r) {
int r; int r;
if (env)
test_shutdown();
r = db_env_create(&env, 0); r = db_env_create(&env, 0);
CKERR(r); CKERR(r);
r = env->open(env, ENVDIR, flags, mode); r = env->open(env, ENVDIR, flags, mode);
...@@ -141,6 +148,8 @@ test_env_startup(int logging) { ...@@ -141,6 +148,8 @@ test_env_startup(int logging) {
delete_log(); delete_log();
reopen_env(flags, ENOENT); reopen_env(flags, ENOENT);
} }
test_shutdown();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment