Commit 983e15c9 authored by Sameer Ajmani's avatar Sameer Ajmani

context: fix small leak introduced by reordering.

LGTM=bcmills
R=bcmills
CC=golang-codereviews
https://golang.org/cl/116420045
parent a67aa996
...@@ -342,7 +342,7 @@ func WithDeadline(parent Context, deadline time.Time) (Context, CancelFunc) { ...@@ -342,7 +342,7 @@ func WithDeadline(parent Context, deadline time.Time) (Context, CancelFunc) {
propagateCancel(parent, c) propagateCancel(parent, c)
d := deadline.Sub(time.Now()) d := deadline.Sub(time.Now())
if d <= 0 { if d <= 0 {
c.cancel(false, DeadlineExceeded) // deadline has already passed c.cancel(true, DeadlineExceeded) // deadline has already passed
return c, func() { c.cancel(true, Canceled) } return c, func() { c.cancel(true, Canceled) }
} }
c.mu.Lock() c.mu.Lock()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment