diff options
author | konstantin@mysql.com <> | 2005-06-28 20:52:15 +0400 |
---|---|---|
committer | konstantin@mysql.com <> | 2005-06-28 20:52:15 +0400 |
commit | 8b0cee88f0da2bbb47a359c29ade03673b97092a (patch) | |
tree | 367d829814e646f5d2f02ee7f128a163a27d9846 /sql/item_subselect.cc | |
parent | d4901de80848f3f9f9359b8816edf4c3eb306573 (diff) | |
download | mariadb-git-8b0cee88f0da2bbb47a359c29ade03673b97092a.tar.gz |
A fix and a test case for Bug#10736 "mysql_stmt_attr_set
CURSOR_TYPE_READ_ONLY select within select".
The bug was caused by the reset of thd->mem_root to thd->main_mem_root in
Item_subselect::exec, which in turn triggered too early free_root() for
data which was needed on subsequent fetches from a cursor.
This reset also caused a memory leak in stored procedures, as
subsequent executions of instructions containing a subselect
were allocating memory in thd->main_mem_root, which is not freed
until the end of the entire SP, instead of the per-call mem_root,
which is freed in the end of execution of the instruction.
Diffstat (limited to 'sql/item_subselect.cc')
-rw-r--r-- | sql/item_subselect.cc | 7 |
1 files changed, 0 insertions, 7 deletions
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 7ea72f3c858..c7587686ecd 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -194,15 +194,8 @@ bool Item_subselect::fix_fields(THD *thd_param, TABLE_LIST *tables, Item **ref) bool Item_subselect::exec() { int res; - MEM_ROOT *old_root= thd->mem_root; - /* - As this is execution, all objects should be allocated through the main - mem root - */ - thd->mem_root= &thd->main_mem_root; res= engine->exec(); - thd->mem_root= old_root; if (engine_changed) { |