mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Bug#23736 Pointer free error in mysqlbinlog
- Mis-matched SAFEMALLOC defines caused misleading error message. client/mysqlbinlog.cc: Bug#23736 Pointer free error in mysqlbinlog - Re-worked the Load_log_processor so that it frees it's resources before my_end is called. This is necessary because SAFEMALLOC's _my_free calls pthread_mutex_lock() using THR_LOCK_malloc which is cleaned up in my_end(). include/my_sys.h: Bug#23736 Pointer free error in mysqlbinlog - Define DYNAMIC_ARRAY beofore MY_TMPDIR - Add DYNAMIC_ARRAY to MY_TMP_DIR mysys/array.c: Bug#23736 Pointer free error in mysqlbinlog - SAFEMALLOC should not be unconditionally undef'd. mysys/mf_tempdir.c: Bug#23736 Pointer free error in mysqlbinlog - Use struct's DYNAMIC_ARRAY. - Use DYNAMIC_ARRAY:delete_dynamic function instead of my_free
This commit is contained in:
@ -155,11 +155,7 @@ class Load_log_processor
|
||||
|
||||
public:
|
||||
Load_log_processor() {}
|
||||
~Load_log_processor()
|
||||
{
|
||||
destroy();
|
||||
delete_dynamic(&file_names);
|
||||
}
|
||||
~Load_log_processor() {}
|
||||
|
||||
int init()
|
||||
{
|
||||
@ -179,20 +175,22 @@ public:
|
||||
target_dir_name_len= strlen(target_dir_name);
|
||||
}
|
||||
void destroy()
|
||||
{
|
||||
File_name_record *ptr= (File_name_record *)file_names.buffer;
|
||||
File_name_record *end= ptr + file_names.elements;
|
||||
for (; ptr < end; ptr++)
|
||||
{
|
||||
File_name_record *ptr= (File_name_record *)file_names.buffer;
|
||||
File_name_record *end= ptr + file_names.elements;
|
||||
for (; ptr<end; ptr++)
|
||||
if (ptr->fname)
|
||||
{
|
||||
if (ptr->fname)
|
||||
{
|
||||
my_free(ptr->fname, MYF(MY_WME));
|
||||
delete ptr->event;
|
||||
bzero((char *)ptr, sizeof(File_name_record));
|
||||
}
|
||||
my_free(ptr->fname, MYF(MY_WME));
|
||||
delete ptr->event;
|
||||
bzero((char *)ptr, sizeof(File_name_record));
|
||||
}
|
||||
}
|
||||
|
||||
delete_dynamic(&file_names);
|
||||
}
|
||||
|
||||
/*
|
||||
Obtain Create_file event for LOAD DATA statement by its file_id.
|
||||
|
||||
@ -1517,6 +1515,7 @@ int main(int argc, char** argv)
|
||||
cleanup();
|
||||
free_defaults(defaults_argv);
|
||||
my_free_open_file_info();
|
||||
load_processor.destroy();
|
||||
/* We cannot free DBUG, it is used in global destructors after exit(). */
|
||||
my_end(MY_DONT_FREE_DBUG);
|
||||
exit(exit_value);
|
||||
|
Reference in New Issue
Block a user