summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2003-07-06 18:11:19 +0300
committerunknown <bell@sanja.is.com.ua>2003-07-06 18:11:19 +0300
commitcd3e15a6f998a74c0f04560bd8243a04e3218d66 (patch)
tree417c9121cc93f1faaf86722736fbe70a3164450e /sql
parent0f792995ec25f26a43c9f34a5f58fbf48e2dadcd (diff)
downloadmariadb-git-cd3e15a6f998a74c0f04560bd8243a04e3218d66.tar.gz
fixed memory leak in group_concat function (BUG#796)
fixed test func_gconcat to be repeatable independent of presend tables and avoid removing user tables mysql-test/r/func_gconcat.result: removed warning in test fixed table tnames (should be tN, where N is number) mysql-test/t/func_gconcat.test: removed warning in test fixed table tnames (should be tN, where N is number) sql/item_sum.cc: added debug information fixed memory leak in group_concat function
Diffstat (limited to 'sql')
-rw-r--r--sql/item_sum.cc18
1 files changed, 12 insertions, 6 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index e16ff6969d3..8d3d0de466a 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -1788,11 +1788,12 @@ Item_func_group_concat::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
bool Item_func_group_concat::setup(THD *thd)
{
+ DBUG_ENTER("Item_func_group_concat::setup");
List<Item> list;
SELECT_LEX *select_lex= thd->lex.current_select->select_lex();
if (select_lex->linkage == GLOBAL_OPTIONS_TYPE)
- return 1;
+ DBUG_RETURN(1);
/*
all not constant fields are push to list and create temp table
*/
@@ -1801,7 +1802,7 @@ bool Item_func_group_concat::setup(THD *thd)
{
Item *item= args[i];
if (list.push_back(item))
- return 1;
+ DBUG_RETURN(1);
if (item->const_item())
{
(void) item->val_int();
@@ -1810,7 +1811,7 @@ bool Item_func_group_concat::setup(THD *thd)
}
}
if (always_null)
- return 0;
+ DBUG_RETURN(0);
List<Item> all_fields(list);
if (arg_count_order)
@@ -1821,13 +1822,18 @@ bool Item_func_group_concat::setup(THD *thd)
}
count_field_types(tmp_table_param,all_fields,0);
+ if (table)
+ {
+ free_tmp_table(thd, table);
+ tmp_table_param->cleanup();
+ }
/*
We have to create a temporary table for that we get descriptions of fields
(types, sizes and so on).
*/
if (!(table=create_tmp_table(thd, tmp_table_param, all_fields, 0,
- 0, 0, 0,select_lex->options | thd->options)))
- return 1;
+ 0, 0, 0,select_lex->options | thd->options)))
+ DBUG_RETURN(1);
table->file->extra(HA_EXTRA_NO_ROWS);
table->no_rows= 1;
@@ -1886,7 +1892,7 @@ bool Item_func_group_concat::setup(THD *thd)
original->table= table;
original->tree_mode= tree_mode;
}
- return 0;
+ DBUG_RETURN(0);
}
/* This is used by rollup to create a separate usable copy of the function */