Skip to content

Commit

Permalink
plugin: do not leak cRelName on error path
Browse files Browse the repository at this point in the history
Fixes #17683

Change-Id: I46f45c63796b58e8a8f14e37592231cbe7cd6934
Reviewed-on: https://go-review.googlesource.com/32438
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
  • Loading branch information
crawshaw committed Nov 1, 2016
1 parent 54ec7b0 commit 719b493
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/plugin/plugin_dlopen.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ func open(name string) (*Plugin, error) {
defer C.free(unsafe.Pointer(cPath))

cRelName := C.CString(name)
defer C.free(unsafe.Pointer(cRelName))
if C.realpath(cRelName, cPath) == nil {
return nil, errors.New("plugin.Open(" + name + "): realpath failed")
}
C.free(unsafe.Pointer(cRelName))

filepath := C.GoString(cPath)

Expand Down

0 comments on commit 719b493

Please sign in to comment.