Skip to content

Commit

Permalink
Apply code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
LinZhihao-723 committed May 6, 2024
1 parent a8caea5 commit cc5b88c
Show file tree
Hide file tree
Showing 3 changed files with 181 additions and 197 deletions.
9 changes: 9 additions & 0 deletions components/core/src/clp/SQLiteDB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ void SQLiteDB::open(string const& path) {
}
}

SQLiteDB::~SQLiteDB() {
if (nullptr == m_db_handle) {
return;
}
if (false == close()) {
SPDLOG_WARN("Memory leak due to failure of closing sqlite database.");
}
}

bool SQLiteDB::close() {
auto return_value = sqlite3_close(m_db_handle);
if (SQLITE_BUSY == return_value) {
Expand Down
6 changes: 1 addition & 5 deletions components/core/src/clp/SQLiteDB.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@ class SQLiteDB {
SQLiteDB() : m_db_handle(nullptr) {}

// Destructor
~SQLiteDB() {
if (nullptr != m_db_handle) {
close();
}
}
~SQLiteDB();

// Methods
void open(std::string const& path);
Expand Down
Loading

0 comments on commit cc5b88c

Please sign in to comment.