Skip to content

Commit

Permalink
resolve SQLite3 memory leak in rtc_cache
Browse files Browse the repository at this point in the history
Fixes memory leak caused by db handles that are not deallocated when db open fails.
  • Loading branch information
Kevonosdiaz authored Oct 11, 2024
1 parent 9fcf870 commit 26241f2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions library/src/rtc_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,10 @@ sqlite3_ptr RTCCache::connect_db(const fs::path& path, bool readonly)
flags |= SQLITE_OPEN_MEMORY;
}
if(sqlite3_open_v2(path.string().c_str(), &db_raw, flags, nullptr) != SQLITE_OK)
{
sqlite3_close(db_raw);
return nullptr;
}

sqlite3_ptr db(db_raw);

Expand Down

0 comments on commit 26241f2

Please sign in to comment.