diff options
author | Dmitry Shulga <Dmitry.Shulga@oracle.com> | 2011-06-10 14:20:15 +0700 |
---|---|---|
committer | Dmitry Shulga <Dmitry.Shulga@oracle.com> | 2011-06-10 14:20:15 +0700 |
commit | ab33df89b6e32af20a04613f45cc47bd11c04cac (patch) | |
tree | 1baeecb0b58bae9ae8a41c5f81245e2b8037b411 /sql/sp_head.cc | |
parent | eee0d59dd81aa7d7e537b1196e7136c23791a266 (diff) | |
parent | 8867ad80ac5e05b22efa12fdc98400860bfcd956 (diff) | |
download | mariadb-git-ab33df89b6e32af20a04613f45cc47bd11c04cac.tar.gz |
Manual-merge of patch for bug#11753738 from mysql-5.1 tree.
Diffstat (limited to 'sql/sp_head.cc')
-rw-r--r-- | sql/sp_head.cc | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/sql/sp_head.cc b/sql/sp_head.cc index a4010a587cc..557865c4830 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -2543,7 +2543,22 @@ void sp_head::restore_thd_mem_root(THD *thd) { DBUG_ENTER("sp_head::restore_thd_mem_root"); - Item *flist= free_list; // The old list + + /* + In some cases our parser detects a syntax error and calls + LEX::cleanup_lex_after_parse_error() method only after + finishing parsing the whole routine. In such a situation + sp_head::restore_thd_mem_root() will be called twice - the + first time as part of normal parsing process and the second + time by cleanup_lex_after_parse_error(). + To avoid ruining active arena/mem_root state in this case we + skip restoration of old arena/mem_root if this method has been + already called for this routine. + */ + if (!m_thd) + DBUG_VOID_RETURN; + + Item *flist= free_list; // The old list set_query_arena(thd); // Get new free_list and mem_root state= STMT_INITIALIZED_FOR_SP; |