diff options
author | Eugene Kosov <claprix@yandex.ru> | 2017-07-05 18:27:03 +0300 |
---|---|---|
committer | Vicențiu Ciorbaru <vicentiu@mariadb.org> | 2017-07-05 18:28:38 +0300 |
commit | 4693f01f57406f86a26b7ccc605522dac6a9abb2 (patch) | |
tree | 9472e4bdc151b61db7af86230da6568e5e01cf94 /sql/sql_explain.cc | |
parent | e555540ab6b9c3e0d4fdd00af093b115a9401d0a (diff) | |
download | mariadb-git-4693f01f57406f86a26b7ccc605522dac6a9abb2.tar.gz |
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>
Diffstat (limited to 'sql/sql_explain.cc')
-rw-r--r-- | sql/sql_explain.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sql/sql_explain.cc b/sql/sql_explain.cc index 6d208121e34..ac6bee05001 100644 --- a/sql/sql_explain.cc +++ b/sql/sql_explain.cc @@ -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), 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()) { - StringBuffer<64> possible_keys_buf; push_string_list(thd, &item_list, *possible_keys, &possible_keys_buf); } else |