Merge pull request #3509 from Zwelf/pr-fix-memory-leak-sqlite3

Fix memory leak in SQLite3 print statement
This commit is contained in:
Dennis Felsing 2021-01-15 09:09:54 +01:00 committed by GitHub
commit b943ca1e0c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -162,7 +162,11 @@ extern char *sqlite3_expanded_sql(sqlite3_stmt *pStmt) __attribute__((weak));
void CSqliteConnection::Print() void CSqliteConnection::Print()
{ {
if(m_pStmt != nullptr && sqlite3_expanded_sql != nullptr) if(m_pStmt != nullptr && sqlite3_expanded_sql != nullptr)
dbg_msg("sql", "SQLite statement: %s", sqlite3_expanded_sql(m_pStmt)); {
char *pExpandedStmt = sqlite3_expanded_sql(m_pStmt);
dbg_msg("sql", "SQLite statement: %s", pExpandedStmt);
sqlite3_free(pExpandedStmt);
}
} }
bool CSqliteConnection::Step() bool CSqliteConnection::Step()