From 20300c2569d5f7562bc05b099893f35bd92c3cb4 Mon Sep 17 00:00:00 2001 From: James Tucker Date: Mon, 5 Jan 2026 17:01:25 -0800 Subject: [PATCH] cgosqlite: fix small leak in DisableFunction Spotted while looking for other bugs. Updates tailscale/corp#31396 --- cgosqlite/cgosqlite.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cgosqlite/cgosqlite.go b/cgosqlite/cgosqlite.go index 9e530e0..386b8df 100644 --- a/cgosqlite/cgosqlite.go +++ b/cgosqlite/cgosqlite.go @@ -206,7 +206,9 @@ func (db *DB) Prepare(query string, prepFlags sqliteh.PrepareFlags) (stmt sqlite } func (db *DB) DisableFunction(name string, numArgs int) error { - return errCode(C.ts_sqlite3_disable_function(db.db, C.CString(name), C.int(numArgs))) + cName := C.CString(name) + defer C.free(unsafe.Pointer(cName)) + return errCode(C.ts_sqlite3_disable_function(db.db, cName, C.int(numArgs))) } func (stmt *Stmt) DBHandle() sqliteh.DB {