Commit 209364ad authored by Max Kellermann's avatar Max Kellermann

db/simple: fix crash when mounting twice

The `db->close()` call was a `nullptr` dereference because the `db` variable had already been moved. Closes https://github.com/MusicPlayerDaemon/MPD/issues/839
parent 24afdee3
ver 0.21.24 (not yet released) ver 0.21.24 (not yet released)
* protocol * protocol
- "tagtypes" requires no permissions - "tagtypes" requires no permissions
* database
- simple: fix crash when mounting twice
* fix unit test failure * fix unit test failure
ver 0.21.23 (2020/04/23) ver 0.21.23 (2020/04/23)
......
...@@ -449,12 +449,7 @@ SimpleDatabase::Mount(const char *local_uri, const char *storage_uri) ...@@ -449,12 +449,7 @@ SimpleDatabase::Mount(const char *local_uri, const char *storage_uri)
// TODO: update the new database instance? // TODO: update the new database instance?
try {
Mount(local_uri, std::move(db)); Mount(local_uri, std::move(db));
} catch (...) {
db->Close();
throw;
}
} }
inline DatabasePtr inline DatabasePtr
......
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