diff options
-rw-r--r-- | src/libstore/db.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libstore/db.cc b/src/libstore/db.cc index ca5d0582a0..f378ef4549 100644 --- a/src/libstore/db.cc +++ b/src/libstore/db.cc @@ -30,7 +30,12 @@ class DestroyDbEnv DbEnv * dbenv; public: DestroyDbEnv(DbEnv * _dbenv) : dbenv(_dbenv) { } - ~DestroyDbEnv() { if (dbenv) { dbenv->close(0); delete dbenv; } } + ~DestroyDbEnv() { + if (dbenv) { + if (dbenv->get_DB_ENV()) dbenv->close(0); + delete dbenv; + } + } void release() { dbenv = 0; }; }; |