mirror of https://github.com/mattn/go-sqlite3.git
chore: Fix memory leak in callbackRetText function
This commit is contained in:
parent
3c0390b77c
commit
d9168d5b44
|
@ -345,7 +345,9 @@ func callbackRetText(ctx *C.sqlite3_context, v reflect.Value) error {
|
|||
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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue