diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2017-02-15 08:57:43 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2017-02-15 08:57:43 +0200 |
commit | 703d0985ee761a81af5d9b8d4374d847dba7cd76 (patch) | |
tree | 2398bcf0e18a39ad869e2f86df31cca2e1236f81 | |
parent | 2af28a363c0ac55c9b91aa9eb26949fc9ecf043a (diff) | |
download | mariadb-git-703d0985ee761a81af5d9b8d4374d847dba7cd76.tar.gz |
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.
-rw-r--r-- | storage/innobase/dict/dict0dict.cc | 21 | ||||
-rw-r--r-- | storage/innobase/handler/ha_innodb.cc | 7 | ||||
-rw-r--r-- | storage/innobase/include/dict0dict.h | 12 | ||||
-rw-r--r-- | storage/innobase/srv/srv0srv.cc | 2 |
4 files changed, 22 insertions, 20 deletions
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc index 21380cffae3..943b79c3514 100644 --- a/storage/innobase/dict/dict0dict.cc +++ b/storage/innobase/dict/dict0dict.cc @@ -2,7 +2,7 @@ Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. 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 the terms of the GNU General Public License as published by the Free Software @@ -6342,11 +6342,9 @@ dict_set_merge_threshold_all_debug( #endif /* UNIV_DEBUG */ -/**********************************************************************//** -Inits dict_ind_redundant. */ +/** Initialize dict_ind_redundant. */ void -dict_ind_init(void) -/*===============*/ +dict_ind_init() { dict_table_t* table; @@ -6364,16 +6362,11 @@ dict_ind_init(void) dict_ind_redundant->cached = TRUE; } -/**********************************************************************//** -Frees dict_ind_redundant. */ -static +/** Free dict_ind_redundant. */ void -dict_ind_free(void) -/*===============*/ +dict_ind_free() { - dict_table_t* table; - - table = dict_ind_redundant->table; + dict_table_t* table = dict_ind_redundant->table; dict_mem_index_free(dict_ind_redundant); dict_ind_redundant = NULL; dict_mem_table_free(table); @@ -6896,8 +6889,6 @@ dict_close(void) therefore we don't delete the individual elements. */ hash_table_free(dict_sys->table_id_hash); - dict_ind_free(); - mutex_free(&dict_sys->mutex); rw_lock_free(dict_operation_lock); diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index fe0c8239315..e53253db19c 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -3695,6 +3695,13 @@ innobase_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; } diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h index 77a2013927e..036d905f0d8 100644 --- a/storage/innobase/include/dict0dict.h +++ b/storage/innobase/include/dict0dict.h @@ -2,7 +2,7 @@ Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. 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 the terms of the GNU General Public License as published by the Free Software @@ -1763,11 +1763,13 @@ struct dict_sys_t{ /** dummy index for ROW_FORMAT=REDUNDANT supremum and infimum records */ extern dict_index_t* dict_ind_redundant; -/**********************************************************************//** -Inits dict_ind_redundant. */ +/** Initialize dict_ind_redundant. */ void -dict_ind_init(void); -/*===============*/ +dict_ind_init(); + +/** Free dict_ind_redundant. */ +void +dict_ind_free(); /* Auxiliary structs for checking a table definition @{ */ diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index a979b107825..a0ff3589198 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -1152,6 +1152,8 @@ srv_free(void) srv_master_thread_disabled_event = NULL; #endif /* UNIV_DEBUG */ + dict_ind_free(); + trx_i_s_cache_free(trx_i_s_cache); ut_free(srv_sys); |