Skip to content

Commit f67c710

Browse files
committed
cgosqlite: fix small leak in DisableFunction
Spotted while looking for other bugs. Updates #cleanup
1 parent 6d58826 commit f67c710

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

cgosqlite/cgosqlite.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,9 @@ func (db *DB) Prepare(query string, prepFlags sqliteh.PrepareFlags) (stmt sqlite
206206
}
207207

208208
func (db *DB) DisableFunction(name string, numArgs int) error {
209-
return errCode(C.ts_sqlite3_disable_function(db.db, C.CString(name), C.int(numArgs)))
209+
cName := C.CString(name)
210+
defer C.free(unsafe.Pointer(cName))
211+
return errCode(C.ts_sqlite3_disable_function(db.db, cName, C.int(numArgs)))
210212
}
211213

212214
func (stmt *Stmt) DBHandle() sqliteh.DB {

0 commit comments

Comments
 (0)