Skip to content

Commit 718fcdc

Browse files
author
James Cor
committed
fix panic
1 parent f3e6ed8 commit 718fcdc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

server/handler.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,9 @@ func (h *Handler) doQuery(
483483
var buf *sql.ByteBuffer
484484
var processedAtLeastOneBatch bool
485485
defer func() {
486-
sql.ByteBufPool.Put(buf)
486+
if buf != nil {
487+
sql.ByteBufPool.Put(buf)
488+
}
487489
}()
488490

489491
// zero/single return schema use spooling shortcut
@@ -745,7 +747,7 @@ func (h *Handler) resultForDefaultIter(ctx *sql.Context, c *mysql.Conn, schema s
745747
return context.Cause(ctx)
746748
case resChan <- bufferedResult{res: res, buf: buf}:
747749
res = nil
748-
buf = nil
750+
buf = nil // TODO: not sure if this is necessary to prevent double Put()
749751
}
750752
}
751753
}

0 commit comments

Comments
 (0)