diff options
author | Yves Fischer <yvesf-git@xapek.org> | 2013-04-18 14:51:11 +0200 |
---|---|---|
committer | Yves Fischer <yvesf-git@xapek.org> | 2013-04-18 14:51:11 +0200 |
commit | 67376eb18a6be1aae934407ad9d86bd6427cc05c (patch) | |
tree | 08356d61b894149479d9693cdd51808b4183dd9d /datastore-leveldb | |
parent | e5342fa4f51b3fcbf931cabeb996183f96ceedbc (diff) | |
download | ebus-alt-67376eb18a6be1aae934407ad9d86bd6427cc05c.tar.gz ebus-alt-67376eb18a6be1aae934407ad9d86bd6427cc05c.zip |
fix segfault in db.cpp:closeDb()
Diffstat (limited to 'datastore-leveldb')
-rw-r--r-- | datastore-leveldb/src/db.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/datastore-leveldb/src/db.cpp b/datastore-leveldb/src/db.cpp index aae378f..a952512 100644 --- a/datastore-leveldb/src/db.cpp +++ b/datastore-leveldb/src/db.cpp @@ -46,10 +46,13 @@ leveldb::DB *getDB(std::string& name) { void closeDB() { - for (auto it = dbs.begin(); it != dbs.end(); ++it) { - std::cout << "Close " << (*it).first << std::endl; + std::cout << "Close Databases: "; + auto it = dbs.begin(); + while (it != dbs.end()) { + std::cout << (*it).first << ". "; delete (*it).second; - dbs.erase(it); + dbs.erase(it++); //post increment! } + std::cout << std::endl; } |