mirror of
https://github.com/golang/go
synced 2024-11-20 08:54:40 -07: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:
parent
54ec7b072e
commit
719b493312
@ -44,10 +44,10 @@ func open(name string) (*Plugin, error) {
|
|||||||
defer C.free(unsafe.Pointer(cPath))
|
defer C.free(unsafe.Pointer(cPath))
|
||||||
|
|
||||||
cRelName := C.CString(name)
|
cRelName := C.CString(name)
|
||||||
|
defer C.free(unsafe.Pointer(cRelName))
|
||||||
if C.realpath(cRelName, cPath) == nil {
|
if C.realpath(cRelName, cPath) == nil {
|
||||||
return nil, errors.New("plugin.Open(" + name + "): realpath failed")
|
return nil, errors.New("plugin.Open(" + name + "): realpath failed")
|
||||||
}
|
}
|
||||||
C.free(unsafe.Pointer(cRelName))
|
|
||||||
|
|
||||||
filepath := C.GoString(cPath)
|
filepath := C.GoString(cPath)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user