mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
database/sql: add missing unlock when context is expired
Missing the DB mutex unlock on an early return after checking if the context has expired. Fixes #17518 Change-Id: I247cafcef62623d813f534a941f3d5a3744f0738 Reviewed-on: https://go-review.googlesource.com/31494 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
9cefbe9d03
commit
692df217ca
1 changed files with 1 additions and 0 deletions
|
|
@ -814,6 +814,7 @@ func (db *DB) conn(ctx context.Context, strategy connReuseStrategy) (*driverConn
|
|||
}
|
||||
// Check if the context is expired.
|
||||
if err := ctx.Err(); err != nil {
|
||||
db.mu.Unlock()
|
||||
return nil, err
|
||||
}
|
||||
lifetime := db.maxLifetime
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue