1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

sql_plugin.cc:

fixed uninit memory access in SET pluginvar=DEFAULT
innodb_mysql.test, innodb_mysql.result:
  test case for SET pluginvar=DEFAULT
This commit is contained in:
serg@janus.mylan
2007-10-08 20:57:37 +02:00
parent df04651d3c
commit 55f7f3ef8e
3 changed files with 12 additions and 3 deletions

View File

@@ -181,6 +181,7 @@ public:
TYPELIB* plugin_var_typelib(void);
uchar* value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
bool check(THD *thd, set_var *var);
bool check_default(enum_var_type type) { return is_readonly(); }
void set_default(THD *thd, enum_var_type type);
bool update(THD *thd, set_var *var);
};
@@ -2168,9 +2169,11 @@ static st_bookmark *register_var(const char *plugin, const char *name,
size= sizeof(int);
break;
case PLUGIN_VAR_LONG:
case PLUGIN_VAR_ENUM:
size= sizeof(long);
break;
case PLUGIN_VAR_LONGLONG:
case PLUGIN_VAR_SET:
size= sizeof(ulonglong);
break;
case PLUGIN_VAR_STR:
@@ -2611,6 +2614,7 @@ void sys_var_pluginvar::set_default(THD *thd, enum_var_type type)
if (is_readonly())
return;
pthread_mutex_lock(&LOCK_global_system_variables);
tgt= real_value_ptr(thd, type);
src= ((void **) (plugin_var + 1) + 1);
@@ -2627,12 +2631,14 @@ void sys_var_pluginvar::set_default(THD *thd, enum_var_type type)
if (!(plugin_var->flags & PLUGIN_VAR_THDLOCAL) || type == OPT_GLOBAL)
{
pthread_mutex_lock(&LOCK_plugin);
plugin_var->update(thd, plugin_var, tgt, src);
pthread_mutex_unlock(&LOCK_plugin);
pthread_mutex_unlock(&LOCK_global_system_variables);
}
else
{
pthread_mutex_unlock(&LOCK_global_system_variables);
plugin_var->update(thd, plugin_var, tgt, src);
}
}