Skip to content

Commit d05ec23

Browse files
committed
Fix connection cleanup to handle nil rawConn
1 parent 93f1a64 commit d05ec23

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

connection.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,11 @@ func (mc *mysqlConn) cleanup() {
153153

154154
// Makes cleanup idempotent
155155
close(mc.closech)
156-
if err := mc.rawConn.Close(); err != nil {
156+
conn := mc.rawConn
157+
if conn == nil {
158+
return
159+
}
160+
if err := conn.Close(); err != nil {
157161
mc.log(err)
158162
}
159163
// This function can be called from multiple goroutines.

0 commit comments

Comments
 (0)