Skip to content

Commit 26241f2

Browse files
authored
resolve SQLite3 memory leak in rtc_cache
Fixes memory leak caused by db handles that are not deallocated when db open fails.
1 parent 9fcf870 commit 26241f2

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

library/src/rtc_cache.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,10 @@ sqlite3_ptr RTCCache::connect_db(const fs::path& path, bool readonly)
108108
flags |= SQLITE_OPEN_MEMORY;
109109
}
110110
if(sqlite3_open_v2(path.string().c_str(), &db_raw, flags, nullptr) != SQLITE_OK)
111+
{
112+
sqlite3_close(db_raw);
111113
return nullptr;
114+
}
112115

113116
sqlite3_ptr db(db_raw);
114117

0 commit comments

Comments
 (0)