From 096d0eae018b8e5d55a109ed511d21612c436cd6 Mon Sep 17 00:00:00 2001 From: Dave Cheney Date: Sat, 18 Aug 2012 15:41:45 +1000 Subject: [PATCH] go.crypto/ssh: fix misplaced defer Fixes golang/go#3972. R=golang-dev, agl, r CC=golang-dev https://golang.org/cl/6448166 --- ssh/client_auth_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ssh/client_auth_test.go b/ssh/client_auth_test.go index 9d1ae2f..11c7227 100644 --- a/ssh/client_auth_test.go +++ b/ssh/client_auth_test.go @@ -160,7 +160,6 @@ func newMockAuthServer(t *testing.T) string { go func() { defer l.Close() c, err := l.Accept() - defer c.Close() if err != nil { t.Errorf("Unable to accept incoming connection: %v", err) return @@ -171,6 +170,7 @@ func newMockAuthServer(t *testing.T) string { t.Logf("Handshaking error: %v", err) return } + defer c.Close() }() return l.Addr().String() }