fixed GH #2277: SQLite null pointer dereference occurs when exception is being thrown

This commit is contained in:
Günter Obiltschnig 2019-06-22 13:59:38 +02:00
parent 5c79a93634
commit d3f44c0209

View File

@ -59,14 +59,16 @@ Utility::TypeMap Utility::_types;
Poco::Mutex Utility::_mutex;
Utility::SQLiteMutex::SQLiteMutex(sqlite3* pDB): _pMutex(sqlite3_db_mutex(pDB))
Utility::SQLiteMutex::SQLiteMutex(sqlite3* pDB): _pMutex((pDB) ? sqlite3_db_mutex(pDB) : 0)
{
if (_pMutex)
sqlite3_mutex_enter(_pMutex);
}
Utility::SQLiteMutex::~SQLiteMutex()
{
if (_pMutex)
sqlite3_mutex_leave(_pMutex);
}