Skip to content

Commit 86127c0

Browse files
committed
add ownership comment to deserialize
1 parent 3c14acf commit 86127c0

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/node_sqlite.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1823,6 +1823,9 @@ void DatabaseSync::Deserialize(const FunctionCallbackInfo<Value>& args) {
18231823
}
18241824
}
18251825

1826+
// sqlite3_malloc64 is required because SQLITE_DESERIALIZE_FREEONCLOSE
1827+
// transfers ownership to SQLite, which calls sqlite3_free() on close.
1828+
// See: https://www.sqlite.org/c3ref/deserialize.html
18261829
unsigned char* buf =
18271830
static_cast<unsigned char*>(sqlite3_malloc64(byte_length));
18281831
if (buf == nullptr) {

0 commit comments

Comments
 (0)