diff options
author | Russ Cox <rsc@golang.org> | 2010-03-03 17:30:29 -0800 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2010-03-03 17:30:29 -0800 |
commit | 74b131c0abf977a4ee94aec42412b16f30f4549c (patch) | |
tree | 8f4e24a53b0f6321f21a65ff035abcba6457b012 | |
parent | f1550482fa382baf529f285897c2f0fb2ab39def (diff) | |
download | go-74b131c0abf977a4ee94aec42412b16f30f4549c.tar.gz go-74b131c0abf977a4ee94aec42412b16f30f4549c.zip |
net: fix nil deref in testTimeout when Dial fails
Pointed out by Scott Schwartz.
Fixes #637.
R=scotts
CC=golang-dev
https://golang.org/cl/225042
-rw-r--r-- | src/pkg/net/timeout_test.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/pkg/net/timeout_test.go b/src/pkg/net/timeout_test.go index f5ec5730f7..be36bcb41f 100644 --- a/src/pkg/net/timeout_test.go +++ b/src/pkg/net/timeout_test.go @@ -12,10 +12,11 @@ import ( func testTimeout(t *testing.T, network, addr string, readFrom bool) { fd, err := Dial(network, "", addr) - defer fd.Close() if err != nil { t.Errorf("dial %s %s failed: %v", network, addr, err) + return } + defer fd.Close() t0 := time.Nanoseconds() fd.SetReadTimeout(1e8) // 100ms var b [100]byte |