From 87933d52619c3f0df84922e23d5a8b03fa050133 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Tue, 14 Nov 2017 07:47:58 +0200 Subject: Handle failures from malloc Most "new" failures fixed in the following files: - sql_select.cc - item.cc - item_func.cc - opt_subselect.cc Other things: - Allocate udf_handler strings in mem_root - Required changes in sql_string.h - Add mem_root as argument to some new [] calls - Mark udf_handler strings as thread specific - Removed some comment blocks with code --- sql/sql_update.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'sql/sql_update.cc') diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 47ec8b89d48..bd577426483 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -451,7 +451,8 @@ int mysql_update(THD *thd, goto err; } } - init_ftfuncs(thd, select_lex, 1); + if (init_ftfuncs(thd, select_lex, 1)) + goto err; table->mark_columns_needed_for_update(); @@ -522,7 +523,8 @@ int mysql_update(THD *thd, */ if (thd->lex->describe) goto produce_explain_and_leave; - explain= query_plan.save_explain_update_data(query_plan.mem_root, thd); + if (!(explain= query_plan.save_explain_update_data(query_plan.mem_root, thd))) + goto err; ANALYZE_START_TRACKING(&explain->command_tracker); @@ -1046,7 +1048,8 @@ produce_explain_and_leave: We come here for various "degenerate" query plans: impossible WHERE, no-partitions-used, impossible-range, etc. */ - query_plan.save_explain_update_data(query_plan.mem_root, thd); + if (!query_plan.save_explain_update_data(query_plan.mem_root, thd)) + goto err; emit_explain_and_leave: int err2= thd->lex->explain->send_explain(thd); @@ -1776,7 +1779,7 @@ int multi_update::prepare(List ¬_used_values, switch_to_nullable_trigger_fields(*values_for_table[i], table); } } - copy_field= new Copy_field[max_fields]; + copy_field= new (thd->mem_root) Copy_field[max_fields]; DBUG_RETURN(thd->is_fatal_error != 0); } -- cgit v1.2.1