database/sql: fix case where Stmt.Close discards error

Fixes a case where the Stmt.Close() function in database/sql discards any error generated by the Close() function of the contained driverStmt.

Fixes #12798

Change-Id: I40384d6165856665b062d15a643e4ecc09d63fda
Reviewed-on: https://go-review.googlesource.com/15178
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:
Ian Gudger 2015-10-01 03:29:27 -07:00 committed by Brad Fitzpatrick
parent f80ff56a7d
commit 73fe61233b
2 changed files with 40 additions and 2 deletions

View file

@ -1576,9 +1576,9 @@ func (s *Stmt) Close() error {
s.closed = true
if s.tx != nil {
s.txsi.Close()
err := s.txsi.Close()
s.mu.Unlock()
return nil
return err
}
s.mu.Unlock()