summaryrefslogtreecommitdiff
path: root/sql/sql_load.cc
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2015-08-24 14:42:07 +0300
committerMonty <monty@mariadb.org>2015-08-27 22:21:08 +0300
commit3cb578c001b2feabd2410f281d20eb6566371453 (patch)
tree4e3781e38f6531ea91ff127c024869c6b88c5849 /sql/sql_load.cc
parentba340d8c47657774ba6d69bfc918dbebaaef6086 (diff)
downloadmariadb-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_load.cc')
-rw-r--r--sql/sql_load.cc20
1 files changed, 12 insertions, 8 deletions
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index 1c08df22755..7d64f263a4a 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -99,7 +99,7 @@ public:
/* load xml */
List<XML_TAG> taglist;
int read_value(int delim, String *val);
- int read_xml();
+ int read_xml(THD *thd);
int clear_level(int level);
my_off_t file_length() { return cache.end_of_file; }
@@ -270,7 +270,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
Item *item;
if (!(item= field_iterator.create_item(thd)))
DBUG_RETURN(TRUE);
- fields_vars.push_back(item->real_item());
+ fields_vars.push_back(item->real_item(), thd->mem_root);
}
bitmap_set_all(table->write_set);
/*
@@ -1151,7 +1151,7 @@ read_xml_field(THD *thd, COPY_INFO &info, TABLE_LIST *table_list,
}
// read row tag and save values into tag list
- if (read_info.read_xml())
+ if (read_info.read_xml(thd))
break;
List_iterator_fast<XML_TAG> xmlit(read_info.taglist);
@@ -1875,7 +1875,7 @@ int READ_INFO::read_value(int delim, String *val)
tags and attributes are stored in taglist
when tag set in ROWS IDENTIFIED BY is closed, we are ready and return
*/
-int READ_INFO::read_xml()
+int READ_INFO::read_xml(THD *thd)
{
DBUG_ENTER("READ_INFO::read_xml");
int chr, chr2, chr3;
@@ -1973,11 +1973,13 @@ int READ_INFO::read_xml()
goto found_eof;
/* save value to list */
- if(tag.length() > 0 && value.length() > 0)
+ if (tag.length() > 0 && value.length() > 0)
{
DBUG_PRINT("read_xml", ("lev:%i tag:%s val:%s",
level,tag.c_ptr_safe(), value.c_ptr_safe()));
- taglist.push_front( new XML_TAG(level, tag, value));
+ XML_TAG *tmp= new XML_TAG(level, tag, value);
+ if (!tmp || taglist.push_front(tmp, thd->mem_root))
+ DBUG_RETURN(1); // End of memory
}
tag.length(0);
value.length(0);
@@ -2037,13 +2039,15 @@ int READ_INFO::read_xml()
}
chr= read_value(delim, &value);
- if(attribute.length() > 0 && value.length() > 0)
+ if (attribute.length() > 0 && value.length() > 0)
{
DBUG_PRINT("read_xml", ("lev:%i att:%s val:%s\n",
level + 1,
attribute.c_ptr_safe(),
value.c_ptr_safe()));
- taglist.push_front(new XML_TAG(level + 1, attribute, value));
+ XML_TAG *tmp= new XML_TAG(level + 1, attribute, value);
+ if (!tmp || taglist.push_front(tmp, thd->mem_root))
+ DBUG_RETURN(1); // End of memory
}
attribute.length(0);
value.length(0);