[Commits] 7e7502e97a1: c
revision-id: 7e7502e97a114deff5d1af1c0a9384d5d95b6d9c (mariadb-10.1.32-76-g7e7502e97a1) parent(s): 74abc32d308cd4f9a23c4f897a76ea75c85a18c9 author: Oleksandr Byelkin committer: Oleksandr Byelkin timestamp: 2018-05-06 22:00:03 +0200 message: c --- mysql-test/t/sp.test | 15 +++++++++++++++ sql/sp_head.cc | 12 ++++++++++-- sql/sp_head.h | 1 + 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test index eeabb0486ca..6be6440c551 100644 --- a/mysql-test/t/sp.test +++ b/mysql-test/t/sp.test @@ -9754,4 +9754,19 @@ DROP TABLE t1, t2; SET max_sp_recursion_depth=default; +--echo # +--echo # MDEV-15347: Valgrind or ASAN errors in mysql_make_view on query +--echo # from information_schema +--echo # + +CREATE VIEW v AS SELECT 1; +CREATE FUNCTION f() RETURNS INT RETURN 1; +--disable_result_log +SELECT * FROM INFORMATION_SCHEMA.TABLES JOIN INFORMATION_SCHEMA.PARAMETERS +UNION +SELECT * FROM INFORMATION_SCHEMA.TABLES JOIN INFORMATION_SCHEMA.PARAMETERS; +--enable_result_log +DROP FUNCTION f; +DROP TABLE v; + --echo #End of 10.1 tests diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 8bf78d97670..5388e72476e 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -619,6 +619,7 @@ sp_head::sp_head() m_backpatch.empty(); m_cont_backpatch.empty(); m_lex.empty(); + m_stmt_lex.empty(); my_hash_init(&m_sptabs, system_charset_info, 0, 0, 0, sp_table_key, 0, 0); my_hash_init(&m_sroutines, system_charset_info, 0, 0, 0, sp_sroutine_key, 0, 0); @@ -834,13 +835,15 @@ sp_head::~sp_head() THD::lex. It is safe to not update LEX::ptr because further query string parsing and execution will be stopped anyway. */ + DBUG_ASSERT(m_lex.elements == m_stmt_lex.elements); while ((lex= (LEX *)m_lex.pop())) { THD *thd= lex->thd; thd->lex->sphead= NULL; lex_end(thd->lex); delete thd->lex; - thd->lex= thd->stmt_lex= lex; + thd->lex= lex; + thd->stmt_lex= m_stmt_lex.pop(); } my_hash_free(&m_sptabs); @@ -2202,13 +2205,15 @@ sp_head::reset_lex(THD *thd) DBUG_ENTER("sp_head::reset_lex"); LEX *sublex; LEX *oldlex= thd->lex; + LEX *oldstmtlex= thd->stmt_lex; sublex= new (thd->mem_root)st_lex_local; if (sublex == 0) DBUG_RETURN(TRUE); thd->lex= thd->stmt_lex= sublex; - (void)m_lex.push_front(oldlex); + if (m_lex.push_front(oldlex) || m_stmt_lex.push_front(oldstmtlex)) + DBUG_RETURN(TRUE); /* Reset most stuff. */ lex_start(thd); @@ -2244,10 +2249,12 @@ sp_head::restore_lex(THD *thd) DBUG_ENTER("sp_head::restore_lex"); LEX *sublex= thd->lex; LEX *oldlex; + LEX *oldstmtlex; sublex->set_trg_event_type_for_tables(); oldlex= (LEX *)m_lex.pop(); + oldstmtlex= (LEX *) m_stmt_lex.pop(); if (! oldlex) DBUG_RETURN(FALSE); // Nothing to restore @@ -2284,6 +2291,7 @@ sp_head::restore_lex(THD *thd) delete sublex; } thd->lex= oldlex; + thd->stmt_lex= oldstmtlex; DBUG_RETURN(FALSE); } diff --git a/sql/sp_head.h b/sql/sp_head.h index 604190079cb..430e2ec89cc 100644 --- a/sql/sp_head.h +++ b/sql/sp_head.h @@ -528,6 +528,7 @@ class sp_head :private Query_arena sp_pcontext *m_pcont; ///< Parse context List<LEX> m_lex; ///< Temp. store for the other lex + List<LEX> m_stmt_lex; ///< Temp. store for the other stmt_lex DYNAMIC_ARRAY m_instr; ///< The "instructions" typedef struct {
participants (1)
-
Oleksandr Byelkin