mirror of https://github.com/golang/go.git
syscall: release a js.Func object in fsCall
A js.Func object in fsCall was created for each call but never released. This CL fixes this. Change-Id: I2e2b504cbf4fb130b8cfe890a66d3a66aadf56a4 Reviewed-on: https://go-review.googlesource.com/c/go/+/217417 Run-TryBot: Hajime Hoshi <hajimehoshi@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Agniva De Sarker <agniva.quicksilver@gmail.com> Reviewed-by: Richard Musiol <neelance@gmail.com>
This commit is contained in:
parent
866920a073
commit
753d56d364
|
|
@ -495,7 +495,7 @@ func fsCall(name string, args ...interface{}) (js.Value, error) {
|
|||
}
|
||||
|
||||
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
|
||||
|
|
@ -511,7 +511,9 @@ func fsCall(name string, args ...interface{}) (js.Value, error) {
|
|||
|
||||
c <- res
|
||||
return nil
|
||||
}))...)
|
||||
})
|
||||
defer f.Release()
|
||||
jsFS.Call(name, append(args, f)...)
|
||||
res := <-c
|
||||
return res.val, res.err
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue