• konstantin@mysql.com's avatar
    A fix and a test case for Bug#10736 "mysql_stmt_attr_set · 8b0cee88
    konstantin@mysql.com authored
    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.
    8b0cee88
item_subselect.cc 43.9 KB