mirror of
https://github.com/golang/go.git
synced 2025-11-10 21:51:05 +00:00
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
This commit is contained in:
parent
f1550482fa
commit
74b131c0ab
1 changed files with 2 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue