summaryrefslogtreecommitdiff
path: root/sql/sp_head.cc
diff options
context:
space:
mode:
authorpem@mysql.comhem.se <>2005-06-30 18:07:06 +0200
committerpem@mysql.comhem.se <>2005-06-30 18:07:06 +0200
commitfda325b943dd56a3762e062570cf081472b046f4 (patch)
treed2ab360420738387ec9248b89a5b579f332c03d1 /sql/sp_head.cc
parentf60ebc4815f9fd7fedacfb849547edf73feee3a9 (diff)
downloadmariadb-git-fda325b943dd56a3762e062570cf081472b046f4.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.
Diffstat (limited to 'sql/sp_head.cc')
-rw-r--r--sql/sp_head.cc14
1 files changed, 13 insertions, 1 deletions
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index e4dc64c993d..b586546bcfe 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -1935,7 +1935,7 @@ int
sp_instr_cpush::execute(THD *thd, uint *nextp)
{
DBUG_ENTER("sp_instr_cpush::execute");
- thd->spcont->push_cursor(&m_lex_keeper);
+ thd->spcont->push_cursor(&m_lex_keeper, this);
*nextp= m_ip+1;
DBUG_RETURN(0);
}
@@ -1994,7 +1994,19 @@ sp_instr_copen::execute(THD *thd, uint *nextp)
}
else
{
+ Query_arena *old_arena= thd->current_arena;
+
+ /*
+ Get the Query_arena from the cpush instruction, which contains
+ the free_list of the query, so new items (if any) are stored in
+ the right free_list, and we can cleanup after each open.
+ */
+ thd->current_arena= c->get_instr();
res= lex_keeper->reset_lex_and_exec_core(thd, nextp, FALSE, this);
+ /* Cleanup the query's items */
+ if (thd->current_arena->free_list)
+ cleanup_items(thd->current_arena->free_list);
+ thd->current_arena= old_arena;
/*
Work around the fact that errors in selects are not returned properly
(but instead converted into a warning), so if a condition handler