| commit | d9168d5b447193d865f043d080101874d3c33b64 | [log] [tgz] |
|---|---|---|
| author | Halil ibrahim Onay <hionay@gmail.com> | Fri Jul 12 14:14:15 2024 |
| committer | Halil ibrahim Onay <hionay@gmail.com> | Fri Jul 12 14:14:15 2024 |
| tree | 511b6365eb3ff5fe7a9d980d76d359ae1554c2a3 | |
| parent | 3c0390b77cba9a7eaee4102e1ca6a35c14e2de7c [diff] |
chore: Fix memory leak in callbackRetText function
diff --git a/callback.go b/callback.go index b794bcd..84612b4 100644 --- a/callback.go +++ b/callback.go
@@ -345,7 +345,9 @@ if v.Type().Kind() != reflect.String { return fmt.Errorf("cannot convert %s to TEXT", v.Type()) } - C._sqlite3_result_text(ctx, C.CString(v.Interface().(string))) + cstr := C.CString(v.Interface().(string)) + defer C.free(unsafe.Pointer(cstr)) + C._sqlite3_result_text(ctx, cstr) return nil }