diff options
author | Oleg Smirnov <olernov@gmail.com> | 2022-10-01 19:37:25 +0400 |
---|---|---|
committer | Oleg Smirnov <olernov@gmail.com> | 2022-10-02 09:23:58 +0400 |
commit | bcaf00f9e52d9b22879f5b4e5c07dc27af7e6bb5 (patch) | |
tree | e9c2cded69eb848d33d085f88316e897b5b47882 /sql/sql_derived.cc | |
parent | 2f37c2dfa1a2050e122e026ec0801bba9ba98cfd (diff) | |
download | mariadb-git-bb-10.11-MDEV-29624.tar.gz |
MDEV-29624 Fix memory leak on pushdown of derived tablebb-10.11-MDEV-29624
Deallocation of TABLE_LIST::dt_handler and TABLE_LIST::pushdown_derived
was performed in multiple places if code. This not only made the code
more difficult to maintain but also lead to memory leaks when
dt_handler and pushdown_derived were allocated but actual pushdown
of the derived table did not take place due to the whole embedding
unit pushdown.
This commit puts deallocation of TABLE_LIST::dt_handler and
TABLE_LIST::pushdown_derived to the single point - JOIN::cleanup().
Diffstat (limited to 'sql/sql_derived.cc')
-rw-r--r-- | sql/sql_derived.cc | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc index 35cdfc840e8..e180dae00f1 100644 --- a/sql/sql_derived.cc +++ b/sql/sql_derived.cc @@ -1000,11 +1000,7 @@ bool mysql_derived_optimize(THD *thd, LEX *lex, TABLE_LIST *derived) /* Create an object for execution of the query specifying the table */ if (!(derived->pushdown_derived= new (thd->mem_root) Pushdown_derived(derived, derived->dt_handler))) - { - delete derived->dt_handler; - derived->dt_handler= NULL; DBUG_RETURN(TRUE); - } } lex->current_select= first_select; @@ -1229,7 +1225,6 @@ bool mysql_derived_fill(THD *thd, LEX *lex, TABLE_LIST *derived) /* Execute the query that specifies the derived table by a foreign engine */ res= derived->pushdown_derived->execute(); unit->executed= true; - delete derived->pushdown_derived; DBUG_RETURN(res); } |