-
unknown authored
query: - When subquery is located in ORDER BY, EXPLAIN will run as follows: select_describe() will run JOIN::prepare()/optimize() for the subquery; then at some point subselect_single_select_engine::prepare() will be called, which will create another join and run join->prepare(). In mainline mysql this is not a problem because subquery's join will be destroyed after the first call. In MariaDB, it won't (table elimination needs to keep JOIN objects around for longer in order to know which tables were eliminated when constructing EXPLAIN EXTENDED warning). Fix the problem of memory leak by calling select_lex->cleanup() in subselect_single_select_engine::prepare().
0230d51b