diff options
author | Monty <monty@mariadb.org> | 2015-08-24 14:42:07 +0300 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2015-08-27 22:21:08 +0300 |
commit | 3cb578c001b2feabd2410f281d20eb6566371453 (patch) | |
tree | 4e3781e38f6531ea91ff127c024869c6b88c5849 /sql/sql_help.cc | |
parent | ba340d8c47657774ba6d69bfc918dbebaaef6086 (diff) | |
download | mariadb-git-3cb578c001b2feabd2410f281d20eb6566371453.tar.gz |
MDEV-6152: Remove calls to current_thd while creating Item
- Part 3: Adding mem_root to push_back() and push_front()
Other things:
- Added THD as an argument to some partition functions.
- Added memory overflow checking for XML tag's in read_xml()
Diffstat (limited to 'sql/sql_help.cc')
-rw-r--r-- | sql/sql_help.cc | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/sql/sql_help.cc b/sql/sql_help.cc index eb0e260c3f4..a0e836da203 100644 --- a/sql/sql_help.cc +++ b/sql/sql_help.cc @@ -151,10 +151,10 @@ void memorize_variant_topic(THD *thd, TABLE *topics, int count, else { if (count == 1) - names->push_back(name); + names->push_back(name, thd->mem_root); String *new_name= new (thd->mem_root) String; get_field(mem_root,find_fields[help_topic_name].field,new_name); - names->push_back(new_name); + names->push_back(new_name, thd->mem_root); } DBUG_VOID_RETURN; } @@ -380,7 +380,7 @@ int search_categories(THD *thd, TABLE *categories, get_field(thd->mem_root,pfname,lname); if (++count == 1 && res_id) *res_id= (int16) pcat_id->val_int(); - names->push_back(lname); + names->push_back(lname, thd->mem_root); } end_read_record(&read_record_info); @@ -415,7 +415,7 @@ void get_all_items_for_category(THD *thd, TABLE *items, Field *pfname, continue; String *name= new (thd->mem_root) String(); get_field(thd->mem_root,pfname,name); - res->push_back(name); + res->push_back(name, thd->mem_root); } end_read_record(&read_record_info); @@ -454,9 +454,12 @@ int send_answer_1(Protocol *protocol, String *s1, String *s2, String *s3) DBUG_ENTER("send_answer_1"); List<Item> field_list; - field_list.push_back(new (mem_root) Item_empty_string(thd, "name", 64)); - field_list.push_back(new (mem_root) Item_empty_string(thd, "description", 1000)); - field_list.push_back(new (mem_root) Item_empty_string(thd, "example", 1000)); + field_list.push_back(new (mem_root) Item_empty_string(thd, "name", 64), + mem_root); + field_list.push_back(new (mem_root) Item_empty_string(thd, "description", 1000), + mem_root); + field_list.push_back(new (mem_root) Item_empty_string(thd, "example", 1000), + mem_root); if (protocol->send_result_set_metadata(&field_list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) @@ -500,11 +503,17 @@ int send_header_2(Protocol *protocol, bool for_category) DBUG_ENTER("send_header_2"); List<Item> field_list; if (for_category) - field_list.push_back(new (mem_root) Item_empty_string(thd, "source_category_name", - 64)); - field_list.push_back(new (mem_root) Item_empty_string(thd, "name", 64)); - field_list.push_back(new (mem_root) Item_empty_string(thd, "is_it_category", 1)); - DBUG_RETURN(protocol->send_result_set_metadata(&field_list, Protocol::SEND_NUM_ROWS | + field_list.push_back(new (mem_root) + Item_empty_string(thd, "source_category_name", 64), + mem_root); + field_list.push_back(new (mem_root) + Item_empty_string(thd, "name", 64), + mem_root); + field_list.push_back(new (mem_root) + Item_empty_string(thd, "is_it_category", 1), + mem_root); + DBUG_RETURN(protocol->send_result_set_metadata(&field_list, + Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)); } |