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 (sw.elapsedSeconds() >= tout)
{
close();
Utility::throwException(_pDB, rc);
}
else Thread::sleep(10);
Thread::sleep(10);
close();
}
}
catch (SQLiteException& ex)
{
close();
throw ConnectionFailedException(ex.displayText());
}

View File

@@ -3368,7 +3368,7 @@ void SQLiteTest::testIllegalFilePath()
{
try
{
Session tmp (Poco::Data::SQLite::Connector::KEY, "\\/some\\/illegal\\/path\\/dummy.db", 1);
Session tmp(Poco::Data::SQLite::Connector::KEY, "\\/some\\/illegal\\/path\\/dummy.db", 1);
fail("must fail");
}
catch (ConnectionFailedException&)