From a143b50a7d47c0cb28be22b2c8362b5a8f591ff0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Wed, 9 Jan 2019 17:57:03 +1100 Subject: [PATCH] Fixed a memory leak If client disconnects without retrieving the resultset, the memory used by the last packet could be leaked if larger than network buffer. --- lib/mysql_data_stream.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/mysql_data_stream.cpp b/lib/mysql_data_stream.cpp index 42bf28fcf..ce142b897 100644 --- a/lib/mysql_data_stream.cpp +++ b/lib/mysql_data_stream.cpp @@ -71,6 +71,10 @@ static void __dump_pkt(const char *func, unsigned char *_ptr, unsigned int len) #define queue_destroy(_q) { \ if (_q.buffer) free(_q.buffer); \ _q.buffer=NULL; \ + if (_q.pkt.ptr) { \ + l_free(_q.pkt.size,_q.pkt.ptr); \ + queueOUT.pkt.ptr=NULL; \ + } \ } #define queue_zero(_q) { \