summaryrefslogtreecommitdiff
path: root/sql/sql_load.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_load.cc')
-rw-r--r--sql/sql_load.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/sql/sql_load.cc b/sql/sql_load.cc
index 0e3cdaac569..a478d84d071 100644
--- a/sql/sql_load.cc
+++ b/sql/sql_load.cc
@@ -44,6 +44,8 @@
#include "wsrep_mysqld.h"
+#include "scope.h" // scope_exit
+
extern "C" int _my_b_net_read(IO_CACHE *info, uchar *Buffer, size_t Count);
class XML_TAG {
@@ -444,6 +446,12 @@ int mysql_load(THD *thd, const sql_exchange *ex, TABLE_LIST *table_list,
if (check_duplic_insert_without_overlaps(thd, table, handle_duplicates) != 0)
DBUG_RETURN(true);
+ auto scope_cleaner = make_scope_exit(
+ [&fields_vars]() {
+ fields_vars.empty();
+ }
+ );
+
if (!fields_vars.elements)
{
Field_iterator_table_ref field_iterator;
@@ -471,6 +479,7 @@ int mysql_load(THD *thd, const sql_exchange *ex, TABLE_LIST *table_list,
}
else
{ // Part field list
+ scope_cleaner.release();
/* TODO: use this conds for 'WITH CHECK OPTIONS' */
if (setup_fields(thd, Ref_ptr_array(),
fields_vars, MARK_COLUMNS_WRITE, 0, NULL, 0) ||