From 719b493312154b43e9ace5743f3d74efb155b9d7 Mon Sep 17 00:00:00 2001 From: David Crawshaw Date: Mon, 31 Oct 2016 08:59:05 -0400 Subject: [PATCH] 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 Run-TryBot: Ian Lance Taylor TryBot-Result: Gobot Gobot --- src/plugin/plugin_dlopen.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)