The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/3717
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === Closes #3711 Signed-off-by: Stéphane Graber <[email protected]>
From 0c138f1f5a6f676b400ac41d091795543770cf67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= <[email protected]> Date: Thu, 24 Aug 2017 15:40:58 -0400 Subject: [PATCH] shared: Fix growing of buf in GroupId MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #3711 Signed-off-by: Stéphane Graber <[email protected]> --- shared/util_linux.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/shared/util_linux.go b/shared/util_linux.go index 02f380822..33747f191 100644 --- a/shared/util_linux.go +++ b/shared/util_linux.go @@ -411,7 +411,6 @@ func GroupId(name string) (int, error) { if buf == nil { return -1, fmt.Errorf("allocation failed") } - defer C.free(buf) cname := C.CString(name) defer C.free(unsafe.Pointer(cname)) @@ -422,7 +421,7 @@ again: (*C.char)(buf), bufSize, &result) - if rv < 0 { + if rv != 0 { // OOM killer will take care of us if we end up doing this too // often. if errno == syscall.ERANGE { @@ -434,8 +433,11 @@ again: buf = tmp goto again } + + C.free(buf) return -1, fmt.Errorf("failed group lookup: %s", syscall.Errno(rv)) } + C.free(buf) if result == nil { return -1, fmt.Errorf("unknown group %s", name)
_______________________________________________ lxc-devel mailing list [email protected] http://lists.linuxcontainers.org/listinfo/lxc-devel
