fixed a memory leak when opening a SQLite database fails

This commit is contained in:
Günter Obiltschnig
2020-01-23 08:41:44 +01:00
parent f7f51b059a
commit d1f3a29da3
2 changed files with 7 additions and 6 deletions

View File

@@ -163,14 +163,15 @@ void SessionImpl::open(const std::string& connect)
if (rc == SQLITE_OK) break; if (rc == SQLITE_OK) break;
if (sw.elapsedSeconds() >= tout) if (sw.elapsedSeconds() >= tout)
{ {
close();
Utility::throwException(_pDB, rc); Utility::throwException(_pDB, rc);
} }
else Thread::sleep(10); Thread::sleep(10);
close();
} }
} }
catch (SQLiteException& ex) catch (SQLiteException& ex)
{ {
close();
throw ConnectionFailedException(ex.displayText()); throw ConnectionFailedException(ex.displayText());
} }