summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/table_sizes.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/table_sizes.cc b/src/table_sizes.cc
index 0dcee37..2b13b6f 100644
--- a/src/table_sizes.cc
+++ b/src/table_sizes.cc
@@ -33,7 +33,8 @@ bool calc_lookup_values_from_cond(THD *thd, Item *cond, TABLE_LIST *table,
33 33
34static int 34static int
35make_db_list(THD *thd, List<LEX_STRING> *db_names, 35make_db_list(THD *thd, List<LEX_STRING> *db_names,
36 LOOKUP_FIELD_VALUES *lookup_field_vals) 36 LOOKUP_FIELD_VALUES *lookup_field_vals,
37 MEM_ROOT *tmp_mem_root)
37{ 38{
38 /* 39 /*
39 If we have db lookup vaule we just add it to list and 40 If we have db lookup vaule we just add it to list and
@@ -50,7 +51,7 @@ make_db_list(THD *thd, List<LEX_STRING> *db_names,
50 } 51 }
51 52
52 return (find_files(thd, db_names, NullS, 53 return (find_files(thd, db_names, NullS,
53 mysql_data_home, NullS, TRUE) != FIND_FILES_OK); 54 mysql_data_home, NullS, TRUE, tmp_mem_root) != FIND_FILES_OK);
54} 55}
55 56
56/*----------------------------------------------------------------------------*/ 57/*----------------------------------------------------------------------------*/
@@ -234,6 +235,9 @@ static int fill_table(THD *thd, TABLE_LIST *tables, Item *cond)
234 235
235 DBUG_ENTER("fill_table"); 236 DBUG_ENTER("fill_table");
236 237
238 MEM_ROOT tmp_mem_root;
239 init_sql_alloc(&tmp_mem_root, TABLE_ALLOC_BLOCK_SIZE, 0);
240
237 memset(&lookup_field_vals, 0, sizeof(LOOKUP_FIELD_VALUES)); 241 memset(&lookup_field_vals, 0, sizeof(LOOKUP_FIELD_VALUES));
238 if (calc_lookup_values_from_cond(thd, cond, tables, &lookup_field_vals)) 242 if (calc_lookup_values_from_cond(thd, cond, tables, &lookup_field_vals))
239 { 243 {
@@ -288,7 +292,7 @@ static int fill_table(THD *thd, TABLE_LIST *tables, Item *cond)
288 goto err; 292 goto err;
289 } 293 }
290 294
291 if (make_db_list(thd, &db_names, &lookup_field_vals)) 295 if (make_db_list(thd, &db_names, &lookup_field_vals, &tmp_mem_root))
292 goto err; 296 goto err;
293 297
294 LEX_STRING *db_name; 298 LEX_STRING *db_name;
@@ -335,6 +339,7 @@ static int fill_table(THD *thd, TABLE_LIST *tables, Item *cond)
335 error = 0; 339 error = 0;
336 340
337err: 341err:
342 free_root(&tmp_mem_root, MYF(0));
338 DBUG_RETURN(error); 343 DBUG_RETURN(error);
339 344
340 return 0; 345 return 0;