Skip to content
Snippets Groups Projects
Commit 753d56d3 authored by Hajime Hoshi's avatar Hajime Hoshi
Browse files

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: default avatarAgniva De Sarker <agniva.quicksilver@gmail.com>
Reviewed-by: default avatarRichard Musiol <neelance@gmail.com>
parent 866920a0
No related branches found
No related tags found
No related merge requests found
...@@ -495,7 +495,7 @@ func fsCall(name string, args ...interface{}) (js.Value, error) { ...@@ -495,7 +495,7 @@ func fsCall(name string, args ...interface{}) (js.Value, error) {
} }
c := make(chan callResult, 1) 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 var res callResult
if len(args) >= 1 { // on Node.js 8, fs.utimes calls the callback without any arguments 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) { ...@@ -511,7 +511,9 @@ func fsCall(name string, args ...interface{}) (js.Value, error) {
c <- res c <- res
return nil return nil
}))...) })
defer f.Release()
jsFS.Call(name, append(args, f)...)
res := <-c res := <-c
return res.val, res.err return res.val, res.err
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment