Skip to content

Commit

Permalink
Merge pull request #179 from ChannelMeter/fix-batch-deadlock-nil-access
Browse files Browse the repository at this point in the history
executeBatch can cause a dead lock to a nil deref causing c.prepMu not to be unlocked.
  • Loading branch information
Phillip Couto committed Jun 17, 2014
2 parents f2deeb6 + 9a7025c commit d97fc30
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d97fc30

Please sign in to comment.