1
0
mirror of https://github.com/golang/go synced 2024-11-23 17:00:07 -07:00

internal/poll: always decref if setting deadline fails

No test because at present it is never called in a way that fails.
When #22114 is implemented, failure will be possible. Not including this
change in that work because this change is separable and clearly correct.

Updates #22114

Change-Id: I81eb9eec8800e8082d918c0e5fb71282f538267e
Reviewed-on: https://go-review.googlesource.com/71751
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Joe Tsai <joetsai@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Ian Lance Taylor 2017-10-18 16:04:45 -07:00
parent 7b9d15d566
commit 3813f941f6

View File

@ -147,11 +147,11 @@ func setDeadlineImpl(fd *FD, t time.Time, mode int) error {
if err := fd.incref(); err != nil {
return err
}
defer fd.decref()
if fd.pd.runtimeCtx == 0 {
return errors.New("file type does not support deadlines")
}
runtime_pollSetDeadline(fd.pd.runtimeCtx, d, mode)
fd.decref()
return nil
}