chore: Fix memory leak in callbackRetText function
This commit is contained in:
committed by
mattn
parent
7658c06970
commit
b9f4d8c067
@@ -345,7 +345,9 @@ func callbackRetText(ctx *C.sqlite3_context, v reflect.Value) error {
|
|||||||
if v.Type().Kind() != reflect.String {
|
if v.Type().Kind() != reflect.String {
|
||||||
return fmt.Errorf("cannot convert %s to TEXT", v.Type())
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user