mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
Don't use free'd memory, bad idea
Free all memory with mutex and destroy mutex as final step
This commit is contained in:
parent
2287cee693
commit
8ae7ef4616
1 changed files with 7 additions and 5 deletions
|
@ -864,20 +864,22 @@ release_table_log()
|
|||
TABLE_LOG_MEMORY_ENTRY *used_list= global_table_log.first_used;
|
||||
DBUG_ENTER("release_table_log");
|
||||
|
||||
VOID(pthread_mutex_destroy(&LOCK_gtl));
|
||||
lock_global_table_log();
|
||||
while (used_list)
|
||||
{
|
||||
TABLE_LOG_MEMORY_ENTRY *tmp= used_list;
|
||||
TABLE_LOG_MEMORY_ENTRY *tmp= used_list->next_log_entry;
|
||||
my_free((char*)used_list, MYF(0));
|
||||
used_list= tmp->next_log_entry;
|
||||
used_list= tmp;
|
||||
}
|
||||
while (free_list)
|
||||
{
|
||||
TABLE_LOG_MEMORY_ENTRY *tmp= free_list;
|
||||
TABLE_LOG_MEMORY_ENTRY *tmp= free_list->next_log_entry;
|
||||
my_free((char*)free_list, MYF(0));
|
||||
free_list= tmp->next_log_entry;
|
||||
free_list= tmp;
|
||||
}
|
||||
VOID(my_close(global_table_log.file_id, MYF(0)));
|
||||
unlock_global_table_log();
|
||||
VOID(pthread_mutex_destroy(&LOCK_gtl));
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue