summaryrefslogtreecommitdiff
path: root/sql/sql_view.cc
diff options
context:
space:
mode:
authorunknown <evgen@sunlight.local>2006-08-07 00:06:54 +0400
committerunknown <evgen@sunlight.local>2006-08-07 00:06:54 +0400
commitca23eef3052ec8a3f02ab83f412871741f20382d (patch)
treec5bdf4d089795e9f0c220462cb5ebb16c509e479 /sql/sql_view.cc
parent65866b7bbaf571964ad328265f3ff7b0b0a47d4b (diff)
parentc34baab996b72ab818692a049b2d5c94f0f5265b (diff)
downloadmariadb-git-ca23eef3052ec8a3f02ab83f412871741f20382d.tar.gz
Merge sunlight.local:/home/evgen/bk-trees/mysql-5.0
into sunlight.local:/local_work/leak_fix sql/sql_view.cc: Auto merged
Diffstat (limited to 'sql/sql_view.cc')
-rw-r--r--sql/sql_view.cc16
1 files changed, 13 insertions, 3 deletions
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index 637d2cc3684..6581297c72e 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -179,15 +179,23 @@ static bool
fill_defined_view_parts (THD *thd, TABLE_LIST *view)
{
LEX *lex= thd->lex;
- bool not_used;
+ bool free_view= 1;
TABLE_LIST decoy;
+ if (view->view)
+ free_view= 0;
memcpy (&decoy, view, sizeof (TABLE_LIST));
- if (!open_table(thd, &decoy, thd->mem_root, &not_used, 0) &&
- !decoy.view)
+ if ((decoy.table= open_table(thd, &decoy, thd->mem_root, NULL, 0)))
{
+ /* 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;
}
+ if (!decoy.view)
+ /* An error while opening the view occurs, caller will handle it */
+ return FALSE;
+
if (!lex->definer)
{
view->definer.host= decoy.definer.host;
@@ -199,6 +207,8 @@ fill_defined_view_parts (THD *thd, TABLE_LIST *view)
if (lex->create_view_suid == VIEW_SUID_DEFAULT)
lex->create_view_suid= decoy.view_suid ?
VIEW_SUID_DEFINER : VIEW_SUID_INVOKER;
+ if (free_view)
+ delete decoy.view;
return FALSE;
}