mirror of
https://github.com/MariaDB/server.git
synced 2025-09-02 09:41:40 +03:00
Applying InnoDB Plugin 1.0.6 snapshot,part 1. Fixes BUG#45992 and BUG#46656
Detailed revision comments: r6130 | marko | 2009-11-02 11:42:56 +0200 (Mon, 02 Nov 2009) | 9 lines branches/zip: Free all resources at shutdown. Set pointers to NULL, so that Valgrind will not complain about freed data structures that are reachable via pointers. This addresses Bug #45992 and Bug #46656. This patch is mostly based on changes copied from branches/embedded-1.0, mainly c5432, c3439, c3134, c2994, c2978, but also some other code was copied. Some added cleanup code is specific to MySQL/InnoDB. rb://199 approved by Sunny Bains
This commit is contained in:
@@ -246,3 +246,34 @@ thr_local_init(void)
|
||||
|
||||
mutex_create(&thr_local_mutex, SYNC_THR_LOCAL);
|
||||
}
|
||||
|
||||
/********************************************************************
|
||||
Close the thread local storage module. */
|
||||
UNIV_INTERN
|
||||
void
|
||||
thr_local_close(void)
|
||||
/*=================*/
|
||||
{
|
||||
ulint i;
|
||||
|
||||
ut_a(thr_local_hash != NULL);
|
||||
|
||||
/* Free the hash elements. We don't remove them from the table
|
||||
because we are going to destroy the table anyway. */
|
||||
for (i = 0; i < hash_get_n_cells(thr_local_hash); i++) {
|
||||
thr_local_t* local;
|
||||
|
||||
local = HASH_GET_FIRST(thr_local_hash, i);
|
||||
|
||||
while (local) {
|
||||
thr_local_t* prev_local = local;
|
||||
|
||||
local = HASH_GET_NEXT(hash, prev_local);
|
||||
ut_a(prev_local->magic_n == THR_LOCAL_MAGIC_N);
|
||||
mem_free(prev_local);
|
||||
}
|
||||
}
|
||||
|
||||
hash_table_free(thr_local_hash);
|
||||
thr_local_hash = NULL;
|
||||
}
|
||||
|
Reference in New Issue
Block a user