(This is a reland of golang.org/cl/217417.)
A js.Func object in fsCall was created for each call but never
released. This CL fixes this.
Change-Id: Ifc0efb997c9b3e04641839691ccc04de61ef28d6
Reviewed-on: https://go-review.googlesource.com/c/go/+/220537
Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
}
c := make(chan callResult, 1)
- jsFS.Call(name, append(args, js.FuncOf(func(this js.Value, args []js.Value) interface{} {
+ f := js.FuncOf(func(this js.Value, args []js.Value) interface{} {
var res callResult
if len(args) >= 1 { // on Node.js 8, fs.utimes calls the callback without any arguments
c <- res
return nil
- }))...)
+ })
+ defer f.Release()
+ jsFS.Call(name, append(args, f)...)
res := <-c
return res.val, res.err
}