Explorar o código

Merge pull request #179 from ChannelMeter/fix-batch-deadlock-nil-access

executeBatch can cause a dead lock to a nil deref causing c.prepMu not to be unlocked.
Phillip Couto %!s(int64=11) %!d(string=hai) anos
pai
achega
d97fc308cf
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  1. 3 0
      conn.go

+ 3 - 0
conn.go

@@ -505,6 +505,9 @@ func (c *Conn) executeBatch(batch *Batch) error {
 		c.prepMu.Lock()
 		found := false
 		for stmt, flight := range c.prep {
+			if flight == nil || flight.info == nil {
+				continue
+			}
 			if bytes.Equal(flight.info.id, x.StatementId) {
 				found = true
 				delete(c.prep, stmt)