File tree Expand file tree Collapse file tree 2 files changed +10
-0
lines changed
Expand file tree Collapse file tree 2 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,12 @@ func newBuffer(nc net.Conn) buffer {
3737 }
3838}
3939
40+ func (b * buffer ) reset () {
41+ b .buf = make ([]byte , defaultBufSize )
42+ b .idx = 0
43+ b .length = 0
44+ }
45+
4046// fill reads into the buffer until at least _need_ bytes are in it
4147func (b * buffer ) fill (need int ) error {
4248 n := b .length
Original file line number Diff line number Diff line change @@ -111,6 +111,10 @@ func (rows *mysqlRows) Close() (err error) {
111111 return err
112112 }
113113
114+ // We can't reuse receive buffer when rows.Close() is called.
115+ // See https://github.com/golang/go/commit/651ddbdb5056ded455f47f9c494c67b389622a47
116+ mc .buf .reset ()
117+
114118 // Remove unread packets from stream
115119 if ! rows .rs .done {
116120 err = mc .readUntilEOF ()
You can’t perform that action at this time.
0 commit comments