1
0
mirror of https://github.com/golang/go synced 2024-10-03 13:21:22 -06:00

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>
This commit is contained in:
David Crawshaw 2016-10-31 08:59:05 -04:00
parent 54ec7b072e
commit 719b493312

View File

@ -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)