diff options
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r-- | sql/sql_parse.cc | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 35bad134127..b293a4119ff 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1146,14 +1146,14 @@ extern "C" pthread_handler_decl(handle_bootstrap,arg) { thd->net.error = 0; close_thread_tables(thd); // Free tables - free_root(&thd->mem_root,MYF(MY_KEEP_PREALLOC)); + free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC)); break; } mysql_parse(thd,thd->query,length); close_thread_tables(thd); // Free tables if (thd->is_fatal_error) break; - free_root(&thd->mem_root,MYF(MY_KEEP_PREALLOC)); + free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC)); free_root(&thd->transaction.mem_root,MYF(MY_KEEP_PREALLOC)); } @@ -1859,7 +1859,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd, VOID(pthread_mutex_unlock(&LOCK_thread_count)); thd->packet.shrink(thd->variables.net_buffer_length); // Reclaim some memory - free_root(&thd->mem_root,MYF(MY_KEEP_PREALLOC)); + free_root(thd->mem_root,MYF(MY_KEEP_PREALLOC)); DBUG_RETURN(error); } @@ -2144,7 +2144,7 @@ mysql_execute_command(THD *thd) query_len= need_conversion? (pstr->length() * to_cs->mbmaxlen) : pstr->length(); - if (!(query_str= alloc_root(&thd->mem_root, query_len+1))) + if (!(query_str= alloc_root(thd->mem_root, query_len+1))) { res= -1; break; // EOM (error should be reported by allocator) @@ -4490,8 +4490,8 @@ mysql_init_select(LEX *lex) bool mysql_new_select(LEX *lex, bool move_down) { - SELECT_LEX *select_lex = new(&lex->thd->mem_root) SELECT_LEX(); - if (!select_lex) + SELECT_LEX *select_lex; + if (!(select_lex= new(lex->thd->mem_root) SELECT_LEX())) return 1; select_lex->select_number= ++lex->thd->select_number; select_lex->init_query(); @@ -4500,9 +4500,10 @@ mysql_new_select(LEX *lex, bool move_down) if (move_down) { /* first select_lex of subselect or derived table */ - SELECT_LEX_UNIT *unit= new(&lex->thd->mem_root) SELECT_LEX_UNIT(); - if (!unit) + SELECT_LEX_UNIT *unit; + if (!(unit= new(lex->thd->mem_root) SELECT_LEX_UNIT())) return 1; + unit->init_query(); unit->init_select(); unit->thd= lex->thd; @@ -4529,7 +4530,8 @@ mysql_new_select(LEX *lex, bool move_down) as far as we included SELECT_LEX for UNION unit should have fake SELECT_LEX for UNION processing */ - fake= unit->fake_select_lex= new(&lex->thd->mem_root) SELECT_LEX(); + if (!(fake= unit->fake_select_lex= new(lex->thd->mem_root) SELECT_LEX())) + return 1; fake->include_standalone(unit, (SELECT_LEX_NODE**)&unit->fake_select_lex); fake->select_number= INT_MAX; |