Commit 703d0985 authored by Marko Mäkelä's avatar Marko Mäkelä

Fix some InnoDB memory leaks.

dict_init_free(): Make global, and move the call from
dict_close() to srv_free(), because this is initialized
earlier than dict_sys.

innobase_space_shutdown(): Do not leak srv_allow_writes_event.
parent 2af28a36
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc. Copyright (c) 2012, Facebook Inc.
Copyright (c) 2013, 2016, MariaDB Corporation. Copyright (c) 2013, 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -6342,11 +6342,9 @@ dict_set_merge_threshold_all_debug( ...@@ -6342,11 +6342,9 @@ dict_set_merge_threshold_all_debug(
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
/**********************************************************************//** /** Initialize dict_ind_redundant. */
Inits dict_ind_redundant. */
void void
dict_ind_init(void) dict_ind_init()
/*===============*/
{ {
dict_table_t* table; dict_table_t* table;
...@@ -6364,16 +6362,11 @@ dict_ind_init(void) ...@@ -6364,16 +6362,11 @@ dict_ind_init(void)
dict_ind_redundant->cached = TRUE; dict_ind_redundant->cached = TRUE;
} }
/**********************************************************************//** /** Free dict_ind_redundant. */
Frees dict_ind_redundant. */
static
void void
dict_ind_free(void) dict_ind_free()
/*===============*/
{ {
dict_table_t* table; dict_table_t* table = dict_ind_redundant->table;
table = dict_ind_redundant->table;
dict_mem_index_free(dict_ind_redundant); dict_mem_index_free(dict_ind_redundant);
dict_ind_redundant = NULL; dict_ind_redundant = NULL;
dict_mem_table_free(table); dict_mem_table_free(table);
...@@ -6896,8 +6889,6 @@ dict_close(void) ...@@ -6896,8 +6889,6 @@ dict_close(void)
therefore we don't delete the individual elements. */ therefore we don't delete the individual elements. */
hash_table_free(dict_sys->table_id_hash); hash_table_free(dict_sys->table_id_hash);
dict_ind_free();
mutex_free(&dict_sys->mutex); mutex_free(&dict_sys->mutex);
rw_lock_free(dict_operation_lock); rw_lock_free(dict_operation_lock);
......
...@@ -3695,6 +3695,13 @@ innobase_space_shutdown() ...@@ -3695,6 +3695,13 @@ innobase_space_shutdown()
} }
srv_tmp_space.shutdown(); srv_tmp_space.shutdown();
#ifdef WITH_INNODB_DISALLOW_WRITES
if (srv_allow_writes_event) {
os_event_destroy(srv_allow_writes_event);
srv_allow_writes_event = NULL;
}
#endif /* WITH_INNODB_DISALLOW_WRITES */
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc. Copyright (c) 2012, Facebook Inc.
Copyright (c) 2013, 2016, MariaDB Corporation. Copyright (c) 2013, 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -1763,11 +1763,13 @@ struct dict_sys_t{ ...@@ -1763,11 +1763,13 @@ struct dict_sys_t{
/** dummy index for ROW_FORMAT=REDUNDANT supremum and infimum records */ /** dummy index for ROW_FORMAT=REDUNDANT supremum and infimum records */
extern dict_index_t* dict_ind_redundant; extern dict_index_t* dict_ind_redundant;
/**********************************************************************//** /** Initialize dict_ind_redundant. */
Inits dict_ind_redundant. */
void void
dict_ind_init(void); dict_ind_init();
/*===============*/
/** Free dict_ind_redundant. */
void
dict_ind_free();
/* Auxiliary structs for checking a table definition @{ */ /* Auxiliary structs for checking a table definition @{ */
......
...@@ -1152,6 +1152,8 @@ srv_free(void) ...@@ -1152,6 +1152,8 @@ srv_free(void)
srv_master_thread_disabled_event = NULL; srv_master_thread_disabled_event = NULL;
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
dict_ind_free();
trx_i_s_cache_free(trx_i_s_cache); trx_i_s_cache_free(trx_i_s_cache);
ut_free(srv_sys); ut_free(srv_sys);
......
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