Skip to content

Commit

Permalink
Fix some InnoDB memory leaks.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dr-m committed Feb 15, 2017
1 parent 2af28a3 commit 703d098
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 20 deletions.
21 changes: 6 additions & 15 deletions storage/innobase/dict/dict0dict.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;

Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
7 changes: 7 additions & 0 deletions storage/innobase/handler/ha_innodb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
12 changes: 7 additions & 5 deletions storage/innobase/include/dict0dict.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 @{ */

Expand Down
2 changes: 2 additions & 0 deletions storage/innobase/srv/srv0srv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 703d098

Please sign in to comment.