summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorPraveenkumar Hulakund <praveenkumar.hulakund@oracle.com>2013-01-10 14:34:27 +0530
committerPraveenkumar Hulakund <praveenkumar.hulakund@oracle.com>2013-01-10 14:34:27 +0530
commit5e399d1cd023345e51fb6dbcb0078074abe039b5 (patch)
tree2e94fc70010c57d56d61363a5e0989cf5bd5519f /sql
parentdf5444d47ca64f4024c959913974a2a06f75ab14 (diff)
downloadmariadb-git-5e399d1cd023345e51fb6dbcb0078074abe039b5.tar.gz
Bug#11749556: DEBUG ASSERTION WHEN ACCESSING A VIEW AND
AVAILABLE MEMORY IS TOO LOW Analysis: --------- In function "mysql_make_view", "table->view" is initialized after parsing(using File_parser::parse) the view definition. If "::parse" function fails then control is moved to label "err:". Here we have assert (table->view == thd->lex). This assert fails if "::parse" function fails, as table->view is not initialized yet. File_parser::parse fails if data being parsed is incorrect/ corrupted or when memory allocation fails. In this scenario its failing because of failure in memory allocation. Fix: --------- In case of failure in function "File_parser::parse", moving to label "err:" is incorrect. Modified code to move to label "end:".
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_view.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index 965aee65d04..41521395757 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -1137,9 +1137,10 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
TODO: when VIEWs will be stored in cache, table mem_root should
be used here
*/
- if (parser->parse((uchar*)table, thd->mem_root, view_parameters,
- required_view_parameters, &file_parser_dummy_hook))
- goto err;
+ if ((result= parser->parse((uchar*)table, thd->mem_root,
+ view_parameters, required_view_parameters,
+ &file_parser_dummy_hook)))
+ goto end;
/*
check old format view .frm
@@ -1185,6 +1186,11 @@ bool mysql_make_view(THD *thd, File_parser *parser, TABLE_LIST *table,
now Lex placed in statement memory
*/
table->view= lex= thd->lex= (LEX*) new(thd->mem_root) st_lex_local;
+ if (!table->view)
+ {
+ result= true;
+ goto end;
+ }
{
char old_db_buf[NAME_LEN+1];