mirror of
https://github.com/MariaDB/server.git
synced 2025-01-30 18:41:56 +01:00
Bug#23736 Pointer free error in mysqlbinlog
- Mis-matched SAFEMALLOC defines caused misleading error message.
This commit is contained in:
parent
9a5f0bff4f
commit
988ce58052
4 changed files with 29 additions and 34 deletions
|
@ -155,11 +155,7 @@ class Load_log_processor
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Load_log_processor() {}
|
Load_log_processor() {}
|
||||||
~Load_log_processor()
|
~Load_log_processor() {}
|
||||||
{
|
|
||||||
destroy();
|
|
||||||
delete_dynamic(&file_names);
|
|
||||||
}
|
|
||||||
|
|
||||||
int init()
|
int init()
|
||||||
{
|
{
|
||||||
|
@ -191,6 +187,8 @@ public:
|
||||||
bzero((char *)ptr, sizeof(File_name_record));
|
bzero((char *)ptr, sizeof(File_name_record));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
delete_dynamic(&file_names);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1517,6 +1515,7 @@ int main(int argc, char** argv)
|
||||||
cleanup();
|
cleanup();
|
||||||
free_defaults(defaults_argv);
|
free_defaults(defaults_argv);
|
||||||
my_free_open_file_info();
|
my_free_open_file_info();
|
||||||
|
load_processor.destroy();
|
||||||
/* We cannot free DBUG, it is used in global destructors after exit(). */
|
/* We cannot free DBUG, it is used in global destructors after exit(). */
|
||||||
my_end(MY_DONT_FREE_DBUG);
|
my_end(MY_DONT_FREE_DBUG);
|
||||||
exit(exit_value);
|
exit(exit_value);
|
||||||
|
|
|
@ -322,15 +322,6 @@ struct st_my_file_info
|
||||||
|
|
||||||
extern struct st_my_file_info *my_file_info;
|
extern struct st_my_file_info *my_file_info;
|
||||||
|
|
||||||
typedef struct st_my_tmpdir
|
|
||||||
{
|
|
||||||
char **list;
|
|
||||||
uint cur, max;
|
|
||||||
#ifdef THREAD
|
|
||||||
pthread_mutex_t mutex;
|
|
||||||
#endif
|
|
||||||
} MY_TMPDIR;
|
|
||||||
|
|
||||||
typedef struct st_dynamic_array
|
typedef struct st_dynamic_array
|
||||||
{
|
{
|
||||||
char *buffer;
|
char *buffer;
|
||||||
|
@ -339,6 +330,16 @@ typedef struct st_dynamic_array
|
||||||
uint size_of_element;
|
uint size_of_element;
|
||||||
} DYNAMIC_ARRAY;
|
} DYNAMIC_ARRAY;
|
||||||
|
|
||||||
|
typedef struct st_my_tmpdir
|
||||||
|
{
|
||||||
|
DYNAMIC_ARRAY full_list;
|
||||||
|
char **list;
|
||||||
|
uint cur, max;
|
||||||
|
#ifdef THREAD
|
||||||
|
pthread_mutex_t mutex;
|
||||||
|
#endif
|
||||||
|
} MY_TMPDIR;
|
||||||
|
|
||||||
typedef struct st_dynamic_string
|
typedef struct st_dynamic_string
|
||||||
{
|
{
|
||||||
char *str;
|
char *str;
|
||||||
|
|
|
@ -15,10 +15,6 @@
|
||||||
|
|
||||||
/* Handling of arrays that can grow dynamicly. */
|
/* Handling of arrays that can grow dynamicly. */
|
||||||
|
|
||||||
#if defined(WIN32) || defined(__WIN__)
|
|
||||||
#undef SAFEMALLOC /* Problems with threads */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "mysys_priv.h"
|
#include "mysys_priv.h"
|
||||||
#include "m_string.h"
|
#include "m_string.h"
|
||||||
|
|
||||||
|
|
|
@ -26,9 +26,8 @@ my_bool init_tmpdir(MY_TMPDIR *tmpdir, const char *pathlist)
|
||||||
{
|
{
|
||||||
char *end, *copy;
|
char *end, *copy;
|
||||||
char buff[FN_REFLEN];
|
char buff[FN_REFLEN];
|
||||||
DYNAMIC_ARRAY t_arr;
|
|
||||||
pthread_mutex_init(&tmpdir->mutex, MY_MUTEX_INIT_FAST);
|
pthread_mutex_init(&tmpdir->mutex, MY_MUTEX_INIT_FAST);
|
||||||
if (my_init_dynamic_array(&t_arr, sizeof(char*), 1, 5))
|
if (my_init_dynamic_array(&tmpdir->full_list, sizeof(char*), 1, 5))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
if (!pathlist || !pathlist[0])
|
if (!pathlist || !pathlist[0])
|
||||||
{
|
{
|
||||||
|
@ -49,14 +48,14 @@ my_bool init_tmpdir(MY_TMPDIR *tmpdir, const char *pathlist)
|
||||||
convert_dirname(buff, pathlist, end);
|
convert_dirname(buff, pathlist, end);
|
||||||
if (!(copy=my_strdup(buff, MYF(MY_WME))))
|
if (!(copy=my_strdup(buff, MYF(MY_WME))))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
if (insert_dynamic(&t_arr, (gptr)©))
|
if (insert_dynamic(&tmpdir->full_list, (gptr)©))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
pathlist=end+1;
|
pathlist=end+1;
|
||||||
}
|
}
|
||||||
while (*end);
|
while (*end);
|
||||||
freeze_size(&t_arr);
|
freeze_size(&tmpdir->full_list);
|
||||||
tmpdir->list=(char **)t_arr.buffer;
|
tmpdir->list=(char **)tmpdir->full_list.buffer;
|
||||||
tmpdir->max=t_arr.elements-1;
|
tmpdir->max=tmpdir->full_list.elements-1;
|
||||||
tmpdir->cur=0;
|
tmpdir->cur=0;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -76,7 +75,7 @@ void free_tmpdir(MY_TMPDIR *tmpdir)
|
||||||
uint i;
|
uint i;
|
||||||
for (i=0; i<=tmpdir->max; i++)
|
for (i=0; i<=tmpdir->max; i++)
|
||||||
my_free(tmpdir->list[i], MYF(0));
|
my_free(tmpdir->list[i], MYF(0));
|
||||||
my_free((gptr)tmpdir->list, MYF(0));
|
delete_dynamic(&tmpdir->full_list);
|
||||||
pthread_mutex_destroy(&tmpdir->mutex);
|
pthread_mutex_destroy(&tmpdir->mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue