diff options
author | unknown <bell@sanja.is.com.ua> | 2004-07-16 15:20:51 +0300 |
---|---|---|
committer | unknown <bell@sanja.is.com.ua> | 2004-07-16 15:20:51 +0300 |
commit | a9908e5c419e44372db101bde76b6a639b553618 (patch) | |
tree | ee87f1663e6d406bd187d01977318e32c015203c /sql/sql_view.cc | |
parent | 3618cc56df927e0ba3207682faca9d461b4a7510 (diff) | |
download | mariadb-git-a9908e5c419e44372db101bde76b6a639b553618.tar.gz |
memory leak removing
BitKeeper/etc/ignore:
Added libmysqld/sql_view.cc to the ignore list
Diffstat (limited to 'sql/sql_view.cc')
-rw-r--r-- | sql/sql_view.cc | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/sql/sql_view.cc b/sql/sql_view.cc index 7739cdf95bf..8d8e3d1d527 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -19,6 +19,7 @@ #include "sql_acl.h" #include "sql_select.h" #include "parse_file.h" +#include "sp.h" static int mysql_register_view(THD *thd, TABLE_LIST *view, enum_view_create_mode mode); @@ -523,9 +524,15 @@ mysql_make_view(File_parser *parser, TABLE_LIST *table) table->view_name.str= table->real_name; table->view_name.length= table->real_name_length; - //TODO: md5 test here and warning if it is differ + /*TODO: md5 test here and warning if it is differ */ - table->view= lex= thd->lex= new st_lex; + /* + TODO: TABLE mem root should be used here when VIEW will be stored in + TABLE cache + + now Lex placed in statement memory + */ + table->view= lex= thd->lex= (LEX*) new(&thd->mem_root) st_lex_local; lex_start(thd, (uchar*)table->query.str, table->query.length); mysql_init_query(thd, true); lex->select_lex.select_number= ++thd->select_number; @@ -563,6 +570,12 @@ mysql_make_view(File_parser *parser, TABLE_LIST *table) } if (!res && !thd->is_fatal_error) { + + /* move SP to main LEX */ + sp_merge_funs(old_lex, lex); + if (lex->spfuns.array.buffer) + hash_free(&lex->spfuns); + old_next= table->next_global; if ((table->next_global= lex->query_tables)) table->next_global->prev_global= &table->next_global; |