mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
MDEV-4801 - Server crashes in my_strdup on setting
innodb_ft_user_stopword_table to DEFAULT Setting plugin string variable with PLUGIN_VAR_MEMALLOC flag to NULL causes server crash. mysql-test/suite/sys_vars/r/innodb_ft_user_stopword_table_basic.result: Reset innodb_ft_user_stopword_table. Also tests MDEV-4801. mysql-test/suite/sys_vars/t/innodb_ft_user_stopword_table_basic.test: Reset innodb_ft_user_stopword_table. Also tests MDEV-4801. sql/sql_plugin.cc: When we got NULL value, do not strdup(NULL).
This commit is contained in:
@ -2700,13 +2700,16 @@ static void update_func_longlong(THD *thd, struct st_mysql_sys_var *var,
|
||||
static void update_func_str(THD *thd, struct st_mysql_sys_var *var,
|
||||
void *tgt, const void *save)
|
||||
{
|
||||
char *old= *(char **) tgt;
|
||||
*(char **)tgt= *(char **) save;
|
||||
char *value= *(char**) save;
|
||||
if (var->flags & PLUGIN_VAR_MEMALLOC)
|
||||
{
|
||||
*(char **)tgt= my_strdup(*(char **) save, MYF(0));
|
||||
char *old= *(char**) tgt;
|
||||
if (value)
|
||||
*(char**) tgt= my_strdup(value, MYF(0));
|
||||
my_free(old);
|
||||
}
|
||||
else
|
||||
*(char**) tgt= value;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user