1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

after merge & valgrind test fixes (BUG#2120)

sql/sql_derived.cc:
  memory leack fixed
sql/sql_lex.cc:
  flag to avoid double cleaning
sql/sql_lex.h:
  flag to avoid double cleaning
sql/sql_select.cc:
  right way to cleanup JOIN_TAB
sql/sql_select.h:
  right way to cleanup JOIN_TAB
sql/sql_union.cc:
  flag to avoid double cleaning
This commit is contained in:
unknown
2004-02-10 02:18:22 +02:00
parent d4767576f8
commit ecb11989ad
6 changed files with 50 additions and 30 deletions

View File

@ -1510,12 +1510,7 @@ JOIN::cleanup()
JOIN_TAB *tab, *end;
for (tab= join_tab, end= tab+tables ; tab != end ; tab++)
{
delete tab->select;
delete tab->quick;
tab->select=0;
tab->quick=0;
x_free(tab->cache.buff);
tab->cache.buff= 0;
tab->cleanup();
}
}
tmp_join->tmp_join= 0;
@ -3759,6 +3754,41 @@ bool error_if_full_join(JOIN *join)
}
/*
cleanup JOIN_TAB
SYNOPSIS
JOIN_TAB::cleanup()
*/
void JOIN_TAB::cleanup()
{
delete select;
select= 0;
delete quick;
quick= 0;
x_free(cache.buff);
cache.buff= 0;
if (table)
{
if (table->key_read)
{
table->key_read= 0;
table->file->extra(HA_EXTRA_NO_KEYREAD);
}
/* Don't free index if we are using read_record */
if (!read_record.table)
table->file->index_end();
/*
We need to reset this for next select
(Tested in part_of_refkey)
*/
table->reginfo.join_tab= 0;
}
end_read_record(&read_record);
}
/*
Free resources of given join
@ -3803,29 +3833,7 @@ JOIN::join_free(bool full)
{
for (tab= join_tab, end= tab+tables; tab != end; tab++)
{
delete tab->select;
delete tab->quick;
tab->select=0;
tab->quick=0;
x_free(tab->cache.buff);
tab->cache.buff= 0;
if (tab->table)
{
if (tab->table->key_read)
{
tab->table->key_read= 0;
tab->table->file->extra(HA_EXTRA_NO_KEYREAD);
}
/* Don't free index if we are using read_record */
if (!tab->read_record.table)
tab->table->file->index_end();
/*
We need to reset this for next select
(Tested in part_of_refkey)
*/
tab->table->reginfo.join_tab= 0;
}
end_read_record(&tab->read_record);
tab->cleanup();
}
table= 0;
}