Bug #29687 mysql_stmt_store_result memory leak in libmysqld

In embedded server we use result->alloc to store field data for the
result, but we didn't clean the result->alloc if the query returned
an empty recordset. Cleaning for the empty recordset enabled
parent 92b65b8a
...@@ -4945,7 +4945,7 @@ static my_bool reset_stmt_handle(MYSQL_STMT *stmt, uint flags) ...@@ -4945,7 +4945,7 @@ static my_bool reset_stmt_handle(MYSQL_STMT *stmt, uint flags)
Reset stored result set if so was requested or it's a part Reset stored result set if so was requested or it's a part
of cursor fetch. of cursor fetch.
*/ */
if (result->data && (flags & RESET_STORE_RESULT)) if (flags & RESET_STORE_RESULT)
{ {
/* Result buffered */ /* Result buffered */
free_root(&result->alloc, MYF(MY_KEEP_PREALLOC)); free_root(&result->alloc, MYF(MY_KEEP_PREALLOC));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment