diff --git a/src/internal/poll/fd_poll_runtime.go b/src/internal/poll/fd_poll_runtime.go index bfbe3c7de46..866f26f3fcf 100644 --- a/src/internal/poll/fd_poll_runtime.go +++ b/src/internal/poll/fd_poll_runtime.go @@ -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 }