Commit c46ce32c authored by Michael Widenius's avatar Michael Widenius

Fixed memory leaks. alias.test now runs clean with valgrind

parent f62f4bd5
...@@ -238,7 +238,7 @@ class sp_handler : public Sql_alloc ...@@ -238,7 +238,7 @@ class sp_handler : public Sql_alloc
/// The class represents parse-time context, which keeps track of declared /// The class represents parse-time context, which keeps track of declared
/// variables/parameters, conditions, handlers, cursors and labels. /// variables/parameters, conditions, handlers, cursors and labels.
/// ///
/// sp_context objects are organized in a tree according to the following /// sp_pcontext objects are organized in a tree according to the following
/// rules: /// rules:
/// - one sp_pcontext object corresponds for for each BEGIN..END block; /// - one sp_pcontext object corresponds for for each BEGIN..END block;
/// - one sp_pcontext object corresponds for each exception handler; /// - one sp_pcontext object corresponds for each exception handler;
......
...@@ -92,6 +92,8 @@ template <typename Element_type> class Bounds_checked_array ...@@ -92,6 +92,8 @@ template <typename Element_type> class Bounds_checked_array
/* /*
A typesafe wrapper around DYNAMIC_ARRAY A typesafe wrapper around DYNAMIC_ARRAY
TODO: Change creator to take a THREAD_SPECIFIC option.
*/ */
template <class Elem> class Dynamic_array template <class Elem> class Dynamic_array
...@@ -106,7 +108,7 @@ template <class Elem> class Dynamic_array ...@@ -106,7 +108,7 @@ template <class Elem> class Dynamic_array
void init(uint prealloc=16, uint increment=16) void init(uint prealloc=16, uint increment=16)
{ {
my_init_dynamic_array(&array, sizeof(Elem), prealloc, increment, my_init_dynamic_array(&array, sizeof(Elem), prealloc, increment,
MYF(MY_THREAD_SPECIFIC)); MYF(0));
} }
/** /**
......
...@@ -3914,8 +3914,7 @@ static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info, ...@@ -3914,8 +3914,7 @@ static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
} }
else else
{ {
Open_table_context ot_ctx(thd, MYSQL_OPEN_TEMPORARY_ONLY); if (open_temporary_table(thd, create_table))
if (open_table(thd, create_table, thd->mem_root, &ot_ctx))
{ {
/* /*
This shouldn't happen as creation of temporary table should make This shouldn't happen as creation of temporary table should make
......
...@@ -153,7 +153,7 @@ int init_account_hash(void) ...@@ -153,7 +153,7 @@ int init_account_hash(void)
{ {
lf_hash_init(&account_hash, sizeof(PFS_account*), LF_HASH_UNIQUE, lf_hash_init(&account_hash, sizeof(PFS_account*), LF_HASH_UNIQUE,
0, 0, account_hash_get_key, &my_charset_bin); 0, 0, account_hash_get_key, &my_charset_bin);
account_hash.size= account_max; /* account_hash.size= account_max; */
account_hash_inited= true; account_hash_inited= true;
} }
return 0; return 0;
......
...@@ -142,7 +142,7 @@ int init_digest_hash(void) ...@@ -142,7 +142,7 @@ int init_digest_hash(void)
lf_hash_init(&digest_hash, sizeof(PFS_statements_digest_stat*), lf_hash_init(&digest_hash, sizeof(PFS_statements_digest_stat*),
LF_HASH_UNIQUE, 0, 0, digest_hash_get_key, LF_HASH_UNIQUE, 0, 0, digest_hash_get_key,
&my_charset_bin); &my_charset_bin);
digest_hash.size= digest_max; /* digest_hash.size= digest_max; */
digest_hash_inited= true; digest_hash_inited= true;
} }
return 0; return 0;
......
...@@ -150,7 +150,7 @@ int init_host_hash(void) ...@@ -150,7 +150,7 @@ int init_host_hash(void)
{ {
lf_hash_init(&host_hash, sizeof(PFS_host*), LF_HASH_UNIQUE, lf_hash_init(&host_hash, sizeof(PFS_host*), LF_HASH_UNIQUE,
0, 0, host_hash_get_key, &my_charset_bin); 0, 0, host_hash_get_key, &my_charset_bin);
host_hash.size= host_max; /* host_hash.size= host_max; */
host_hash_inited= true; host_hash_inited= true;
} }
return 0; return 0;
......
...@@ -515,7 +515,7 @@ int init_file_hash(void) ...@@ -515,7 +515,7 @@ int init_file_hash(void)
{ {
lf_hash_init(&filename_hash, sizeof(PFS_file*), LF_HASH_UNIQUE, lf_hash_init(&filename_hash, sizeof(PFS_file*), LF_HASH_UNIQUE,
0, 0, filename_hash_get_key, &my_charset_bin); 0, 0, filename_hash_get_key, &my_charset_bin);
filename_hash.size= file_max; /* filename_hash.size= file_max; */
filename_hash_inited= true; filename_hash_inited= true;
} }
DBUG_RETURN(0); DBUG_RETURN(0);
......
...@@ -385,7 +385,7 @@ int init_table_share_hash(void) ...@@ -385,7 +385,7 @@ int init_table_share_hash(void)
{ {
lf_hash_init(&table_share_hash, sizeof(PFS_table_share*), LF_HASH_UNIQUE, lf_hash_init(&table_share_hash, sizeof(PFS_table_share*), LF_HASH_UNIQUE,
0, 0, table_share_hash_get_key, &my_charset_bin); 0, 0, table_share_hash_get_key, &my_charset_bin);
table_share_hash.size= table_share_max; /* table_share_hash.size= table_share_max; */
table_share_hash_inited= true; table_share_hash_inited= true;
} }
return 0; return 0;
......
...@@ -104,7 +104,7 @@ int init_setup_actor_hash(void) ...@@ -104,7 +104,7 @@ int init_setup_actor_hash(void)
{ {
lf_hash_init(&setup_actor_hash, sizeof(PFS_setup_actor*), LF_HASH_UNIQUE, lf_hash_init(&setup_actor_hash, sizeof(PFS_setup_actor*), LF_HASH_UNIQUE,
0, 0, setup_actor_hash_get_key, &my_charset_bin); 0, 0, setup_actor_hash_get_key, &my_charset_bin);
setup_actor_hash.size= setup_actor_max; /* setup_actor_hash.size= setup_actor_max; */
setup_actor_hash_inited= true; setup_actor_hash_inited= true;
} }
return 0; return 0;
......
...@@ -99,7 +99,7 @@ int init_setup_object_hash(void) ...@@ -99,7 +99,7 @@ int init_setup_object_hash(void)
{ {
lf_hash_init(&setup_object_hash, sizeof(PFS_setup_object*), LF_HASH_UNIQUE, lf_hash_init(&setup_object_hash, sizeof(PFS_setup_object*), LF_HASH_UNIQUE,
0, 0, setup_object_hash_get_key, &my_charset_bin); 0, 0, setup_object_hash_get_key, &my_charset_bin);
setup_object_hash.size= setup_object_max; /* setup_object_hash.size= setup_object_max; */
setup_object_hash_inited= true; setup_object_hash_inited= true;
} }
return 0; return 0;
......
...@@ -150,7 +150,7 @@ int init_user_hash(void) ...@@ -150,7 +150,7 @@ int init_user_hash(void)
{ {
lf_hash_init(&user_hash, sizeof(PFS_user*), LF_HASH_UNIQUE, lf_hash_init(&user_hash, sizeof(PFS_user*), LF_HASH_UNIQUE,
0, 0, user_hash_get_key, &my_charset_bin); 0, 0, user_hash_get_key, &my_charset_bin);
user_hash.size= user_max; /* user_hash.size= user_max; */
user_hash_inited= true; user_hash_inited= true;
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment