summaryrefslogtreecommitdiff
path: root/datastore-leveldb/src/db.cpp
diff options
context:
space:
mode:
authorYves Fischer <yvesf-git@xapek.org>2013-04-18 14:51:11 +0200
committerYves Fischer <yvesf-git@xapek.org>2013-04-18 14:51:11 +0200
commit67376eb18a6be1aae934407ad9d86bd6427cc05c (patch)
tree08356d61b894149479d9693cdd51808b4183dd9d /datastore-leveldb/src/db.cpp
parente5342fa4f51b3fcbf931cabeb996183f96ceedbc (diff)
downloadebus-alt-67376eb18a6be1aae934407ad9d86bd6427cc05c.tar.gz
ebus-alt-67376eb18a6be1aae934407ad9d86bd6427cc05c.zip
fix segfault in db.cpp:closeDb()
Diffstat (limited to 'datastore-leveldb/src/db.cpp')
-rw-r--r--datastore-leveldb/src/db.cpp9
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;
}