1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Fix warning discovered by ASAN

Patch submitted by Eugene Kosov <claprix@yandex.ru>,
comments added by commiter.

Signed-off-by: Vicențiu Ciorbaru <vicentiu@mariadb.org>
This commit is contained in:
Eugene Kosov
2017-07-05 18:27:03 +03:00
committed by Vicențiu Ciorbaru
parent e555540ab6
commit 4693f01f57

View File

@@ -349,10 +349,13 @@ int print_explain_row(select_result_sink *result,
item_list.push_back(new (mem_root) Item_string_sys(thd, jtype_str), item_list.push_back(new (mem_root) Item_string_sys(thd, jtype_str),
mem_root); mem_root);
/* 'possible_keys' */ /* 'possible_keys'
The buffer must not be deallocated before we call send_data, otherwise
we may end up reading freed memory.
*/
StringBuffer<64> possible_keys_buf;
if (possible_keys && !possible_keys->is_empty()) if (possible_keys && !possible_keys->is_empty())
{ {
StringBuffer<64> possible_keys_buf;
push_string_list(thd, &item_list, *possible_keys, &possible_keys_buf); push_string_list(thd, &item_list, *possible_keys, &possible_keys_buf);
} }
else else