summaryrefslogtreecommitdiff
path: root/sql/sql_plugin.cc
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@mariadb.org>2013-08-06 14:02:07 +0400
committerSergey Vojtovich <svoj@mariadb.org>2013-08-06 14:02:07 +0400
commit5997156b9b5381c5dba9f782fec2a7347689a831 (patch)
treea8edffde9446fa8d8cd173d646d09ace3fcdb65f /sql/sql_plugin.cc
parent9d1f31fb4b9f4822146ddab626a470f085ec866f (diff)
downloadmariadb-git-5997156b9b5381c5dba9f782fec2a7347689a831.tar.gz
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).
Diffstat (limited to 'sql/sql_plugin.cc')
-rw-r--r--sql/sql_plugin.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index e89054ac849..941587150f3 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -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;
}