]> Cypherpunks repositories - gostls13.git/commitdiff
database/sql: add missing unlock when context is expired
authorDaniel Theophanes <kardianos@gmail.com>
Wed, 19 Oct 2016 19:26:55 +0000 (12:26 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Thu, 20 Oct 2016 08:48:44 +0000 (08:48 +0000)
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>

src/database/sql/sql.go

index defe9607420bba0c831e5937b0853d36cf6ab50c..d3630089937611ceefca4025ba36f4109dc21140 100644 (file)
@@ -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