diff options
author | Tor Didriksen <tor.didriksen@oracle.com> | 2012-09-12 08:59:44 +0200 |
---|---|---|
committer | Tor Didriksen <tor.didriksen@oracle.com> | 2012-09-12 08:59:44 +0200 |
commit | 26269e0d4b2575af27661658a9e876cb388fc153 (patch) | |
tree | 606592d485c767396d825f4e7380cbb83f6e23f7 /sql/sql_select.cc | |
parent | bcf36b227a1a8e788058c150d3293eaf523ac3eb (diff) | |
parent | 06e4a9696b2cc314ac4d2fb09f4151060a3ac434 (diff) | |
download | mariadb-git-26269e0d4b2575af27661658a9e876cb388fc153.tar.gz |
merge 5.1 => 5.5
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r-- | sql/sql_select.cc | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 808af9d69ab..fd6d0e44597 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1719,6 +1719,8 @@ JOIN::optimize() */ void JOIN::restore_tmp() { + DBUG_PRINT("info", ("restore_tmp this %p tmp_join %p", this, tmp_join)); + DBUG_ASSERT(tmp_join != this); memcpy(tmp_join, this, (size_t) sizeof(JOIN)); } @@ -7202,13 +7204,18 @@ void JOIN::cleanup(bool full) { if (tmp_join) tmp_table_param.copy_field= 0; - group_fields.delete_elements(); + /* - Ensure that the above delete_elements() would not be called + Ensure that the following delete_elements() would not be called twice for the same list. */ - if (tmp_join && tmp_join != this) - tmp_join->group_fields= group_fields; + if (tmp_join && tmp_join != this && + tmp_join->group_fields == this->group_fields) + tmp_join->group_fields.empty(); + + // Run Cached_item DTORs! + group_fields.delete_elements(); + /* We can't call delete_elements() on copy_funcs as this will cause problems in free_elements() as some of the elements are then deleted. |