Commit 5082d2d0 authored by unknown's avatar unknown

Fixed references to uninitialized memory


sql/sp.cc:
  Simpe fix to avoid reference to unallocated memory (only opened was needed, but I reset both to make things safer and simpler)
parent dc4a3901
...@@ -72,6 +72,9 @@ db_find_routine_aux(THD *thd, int type, sp_name *name, ...@@ -72,6 +72,9 @@ db_find_routine_aux(THD *thd, int type, sp_name *name,
DBUG_PRINT("enter", ("type: %d name: %*s", DBUG_PRINT("enter", ("type: %d name: %*s",
type, name->m_name.length, name->m_name.str)); type, name->m_name.length, name->m_name.str));
*opened= FALSE;
*tablep= 0;
/* /*
Speed up things if mysql.proc doesn't exists. mysql_proc_table_exists Speed up things if mysql.proc doesn't exists. mysql_proc_table_exists
is set when we create or read stored procedure or on flush privileges. is set when we create or read stored procedure or on flush privileges.
...@@ -88,9 +91,7 @@ db_find_routine_aux(THD *thd, int type, sp_name *name, ...@@ -88,9 +91,7 @@ db_find_routine_aux(THD *thd, int type, sp_name *name,
strcmp(table->s->table_name, "proc") == 0) strcmp(table->s->table_name, "proc") == 0)
break; break;
} }
if (table) if (!table)
*opened= FALSE;
else
{ {
TABLE_LIST tables; TABLE_LIST tables;
...@@ -99,7 +100,6 @@ db_find_routine_aux(THD *thd, int type, sp_name *name, ...@@ -99,7 +100,6 @@ db_find_routine_aux(THD *thd, int type, sp_name *name,
tables.table_name= tables.alias= (char*)"proc"; tables.table_name= tables.alias= (char*)"proc";
if (! (table= open_ltable(thd, &tables, ltype))) if (! (table= open_ltable(thd, &tables, ltype)))
{ {
*tablep= NULL;
/* /*
Under explicit LOCK TABLES or in prelocked mode we should not Under explicit LOCK TABLES or in prelocked mode we should not
say that mysql.proc table does not exist if we are unable to say that mysql.proc table does not exist if we are unable to
...@@ -131,7 +131,6 @@ db_find_routine_aux(THD *thd, int type, sp_name *name, ...@@ -131,7 +131,6 @@ db_find_routine_aux(THD *thd, int type, sp_name *name,
key, table->key_info->key_length, key, table->key_info->key_length,
HA_READ_KEY_EXACT)) HA_READ_KEY_EXACT))
{ {
*tablep= NULL;
DBUG_RETURN(SP_KEY_NOT_FOUND); DBUG_RETURN(SP_KEY_NOT_FOUND);
} }
*tablep= table; *tablep= table;
......
...@@ -1101,7 +1101,7 @@ void st_select_lex::init_query() ...@@ -1101,7 +1101,7 @@ void st_select_lex::init_query()
embedding= leaf_tables= 0; embedding= leaf_tables= 0;
item_list.empty(); item_list.empty();
join= 0; join= 0;
where= prep_where= 0; having= where= prep_where= 0;
olap= UNSPECIFIED_OLAP_TYPE; olap= UNSPECIFIED_OLAP_TYPE;
having_fix_field= 0; having_fix_field= 0;
resolve_mode= NOMATTER_MODE; resolve_mode= NOMATTER_MODE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment