diff options
author | Dominick Allen <djallen@librehumanitas.org> | 2024-10-01 23:04:25 -0500 |
---|---|---|
committer | Dominick Allen <djallen@librehumanitas.org> | 2024-10-01 23:04:25 -0500 |
commit | 3a18a6dcab45467e779e91c7b346aa3b148e8b9c (patch) | |
tree | ba0d7d521179c2d3fbd7d989eb2033cd2a86dbaf /source/fud_sqlite.cpp | |
parent | 4ef88103f74a3a6e8e36ae9eff80f641e20bd1a1 (diff) |
Fix move assignment operators or delete them to prevent leaks.
Diffstat (limited to 'source/fud_sqlite.cpp')
-rw-r--r-- | source/fud_sqlite.cpp | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/source/fud_sqlite.cpp b/source/fud_sqlite.cpp index 7ad8a12..f573f1c 100644 --- a/source/fud_sqlite.cpp +++ b/source/fud_sqlite.cpp @@ -49,6 +49,11 @@ SqliteDb::~SqliteDb() SqliteDb& SqliteDb::operator=(SqliteDb&& rhs) { + if (m_dbHandle != nullptr) { + sqlite3_close(m_dbHandle); + m_dbHandle = nullptr; + } + m_name = std::move(rhs.m_name); m_nameValid = rhs.m_nameValid; m_dbHandle = rhs.m_dbHandle; @@ -162,21 +167,6 @@ SqliteStatement::SqliteStatement(SqliteStatement&& rhs) : rhs.m_preparedStatement = nullptr; } -SqliteStatement& SqliteStatement::operator=(SqliteStatement&& rhs) -{ - m_input = std::move(rhs.m_input); - m_tail = rhs.m_tail; - m_status = rhs.m_status; - m_errorCode = rhs.m_errorCode; - m_preparedStatement = rhs.m_preparedStatement; - - rhs.m_tail = nullptr; - rhs.m_status = FudStatus::ObjectInvalid; - rhs.m_preparedStatement = nullptr; - - return *this; -} - SqliteStatement::~SqliteStatement() { if (m_preparedStatement != nullptr) { |