aboutsummaryrefslogtreecommitdiff
path: root/src/plugin
diff options
context:
space:
mode:
authorDavid Crawshaw <crawshaw@golang.org>2016-10-31 08:59:05 -0400
committerDavid Crawshaw <crawshaw@golang.org>2016-11-01 16:04:28 +0000
commit719b493312154b43e9ace5743f3d74efb155b9d7 (patch)
tree4a1e432af6a4dbffbb2c06d88d86039d5fcb3372 /src/plugin
parent54ec7b072e017f7351f889f9f5b31bbf53a44119 (diff)
downloadgo-719b493312154b43e9ace5743f3d74efb155b9d7.tar.gz
go-719b493312154b43e9ace5743f3d74efb155b9d7.zip
plugin: do not leak cRelName on error path
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>
Diffstat (limited to 'src/plugin')
-rw-r--r--src/plugin/plugin_dlopen.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/plugin/plugin_dlopen.go b/src/plugin/plugin_dlopen.go
index 4a3eb3d861..f4addde74c 100644
--- a/src/plugin/plugin_dlopen.go
+++ b/src/plugin/plugin_dlopen.go
@@ -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)