Commit ca23eef3 authored by unknown's avatar unknown

Merge sunlight.local:/home/evgen/bk-trees/mysql-5.0

into  sunlight.local:/local_work/leak_fix


sql/sql_view.cc:
  Auto merged
parents 65866b7b c34baab9
...@@ -179,15 +179,23 @@ static bool ...@@ -179,15 +179,23 @@ static bool
fill_defined_view_parts (THD *thd, TABLE_LIST *view) fill_defined_view_parts (THD *thd, TABLE_LIST *view)
{ {
LEX *lex= thd->lex; LEX *lex= thd->lex;
bool not_used; bool free_view= 1;
TABLE_LIST decoy; TABLE_LIST decoy;
if (view->view)
free_view= 0;
memcpy (&decoy, view, sizeof (TABLE_LIST)); memcpy (&decoy, view, sizeof (TABLE_LIST));
if (!open_table(thd, &decoy, thd->mem_root, &not_used, 0) && if ((decoy.table= open_table(thd, &decoy, thd->mem_root, NULL, 0)))
!decoy.view)
{ {
/* It's a table */
my_free((gptr)decoy.table, MYF(0));
my_error(ER_WRONG_OBJECT, MYF(0), view->db, view->table_name, "VIEW");
return TRUE; return TRUE;
} }
if (!decoy.view)
/* An error while opening the view occurs, caller will handle it */
return FALSE;
if (!lex->definer) if (!lex->definer)
{ {
view->definer.host= decoy.definer.host; view->definer.host= decoy.definer.host;
...@@ -199,6 +207,8 @@ fill_defined_view_parts (THD *thd, TABLE_LIST *view) ...@@ -199,6 +207,8 @@ fill_defined_view_parts (THD *thd, TABLE_LIST *view)
if (lex->create_view_suid == VIEW_SUID_DEFAULT) if (lex->create_view_suid == VIEW_SUID_DEFAULT)
lex->create_view_suid= decoy.view_suid ? lex->create_view_suid= decoy.view_suid ?
VIEW_SUID_DEFINER : VIEW_SUID_INVOKER; VIEW_SUID_DEFINER : VIEW_SUID_INVOKER;
if (free_view)
delete decoy.view;
return FALSE; return FALSE;
} }
......
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