summaryrefslogtreecommitdiff
path: root/sql/sp_rcontext.cc
diff options
context:
space:
mode:
authorunknown <pem@mysql.comhem.se>2005-06-30 18:07:06 +0200
committerunknown <pem@mysql.comhem.se>2005-06-30 18:07:06 +0200
commita95bb38a7fd03bc464d901300e2a9ef5710218c0 (patch)
treed2ab360420738387ec9248b89a5b579f332c03d1 /sql/sp_rcontext.cc
parentec9ac3fe5c823b6ae7ccb0902c267b811bf732e7 (diff)
downloadmariadb-git-a95bb38a7fd03bc464d901300e2a9ef5710218c0.tar.gz
Fixed BUG#11529: crash server after use stored procedure
Make sure to cleanup the items for a cursor query after each open, otherwise it's done too late, after the run-time mem_root is freed. mysql-test/r/sp.result: New test case for BUG#11529. mysql-test/t/sp.test: New test case for BUG#11529. sql/sp_head.cc: Add a back pointer from a sp_cursor to its cpush instruction, and use it to set the arena and cleanup the items for the cursor's query when opening it. sql/sp_rcontext.cc: Store pointer in sp_cursor to its cpush instruction. sql/sp_rcontext.h: Store pointer in sp_cursor to its cpush instruction.
Diffstat (limited to 'sql/sp_rcontext.cc')
-rw-r--r--sql/sp_rcontext.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/sql/sp_rcontext.cc b/sql/sp_rcontext.cc
index aacb9254753..d0817e43790 100644
--- a/sql/sp_rcontext.cc
+++ b/sql/sp_rcontext.cc
@@ -148,9 +148,9 @@ sp_rcontext::restore_variables(uint fp)
}
void
-sp_rcontext::push_cursor(sp_lex_keeper *lex_keeper)
+sp_rcontext::push_cursor(sp_lex_keeper *lex_keeper, sp_instr_cpush *i)
{
- m_cstack[m_ccount++]= new sp_cursor(lex_keeper);
+ m_cstack[m_ccount++]= new sp_cursor(lex_keeper, i);
}
void
@@ -169,8 +169,9 @@ sp_rcontext::pop_cursors(uint count)
*
*/
-sp_cursor::sp_cursor(sp_lex_keeper *lex_keeper)
- :m_lex_keeper(lex_keeper), m_prot(NULL), m_isopen(0), m_current_row(NULL)
+sp_cursor::sp_cursor(sp_lex_keeper *lex_keeper, sp_instr_cpush *i)
+ :m_lex_keeper(lex_keeper), m_prot(NULL), m_isopen(0), m_current_row(NULL),
+ m_i(i)
{
/*
currsor can't be stored in QC, so we should prevent opening QC for