]> Cypherpunks repositories - gostls13.git/commit
database/sql: fix double connection free on Stmt.Query error
authorBrad Fitzpatrick <bradfitz@golang.org>
Sat, 10 Mar 2012 18:00:02 +0000 (10:00 -0800)
committerBrad Fitzpatrick <bradfitz@golang.org>
Sat, 10 Mar 2012 18:00:02 +0000 (10:00 -0800)
commit3297fc63d6226f6ed47a4fdb5962c78c55c5339c
treeb7460a8eaf8670853407fb434f35ed56a2158a5c
parent81a38fbb771d1282e5092dfc831ff225b60e2f13
database/sql: fix double connection free on Stmt.Query error

In a transaction, on a Stmt.Query error, it was possible for a
connection to be added to a db's freelist twice. Should use
the local releaseConn function instead.

Thanks to Gwenael Treguier for the failing test.

Also in this CL: propagate driver errors through releaseConn
into *DB.putConn, which conditionally ignores the freelist
addition if the driver signaled ErrBadConn, introduced in a
previous CL.

R=golang-dev, gary.burd
CC=golang-dev
https://golang.org/cl/5798049
src/pkg/database/sql/fakedb_test.go
src/pkg/database/sql/sql.go
src/pkg/database/sql/sql_test.go