Skip to content

Commit

Permalink
Fix warning discovered by ASAN
Browse files Browse the repository at this point in the history
Patch submitted by Eugene Kosov <claprix@yandex.ru>,
comments added by commiter.

Signed-off-by: Vicențiu Ciorbaru <vicentiu@mariadb.org>
  • Loading branch information
kevgs authored and cvicentiu committed Jul 5, 2017
1 parent e555540 commit 4693f01
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions sql/sql_explain.cc
Expand Up @@ -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
Expand Down

0 comments on commit 4693f01

Please sign in to comment.