diff options
author | unknown <acurtis/antony@xiphis.org/ltamd64.xiphis.org> | 2007-10-04 10:55:08 -0700 |
---|---|---|
committer | unknown <acurtis/antony@xiphis.org/ltamd64.xiphis.org> | 2007-10-04 10:55:08 -0700 |
commit | 1c94c8e674735337af6170cc21db3f685fe4e321 (patch) | |
tree | d62a7dda2fcb26f6bd04fe1653abe226e24daa01 /sql/sql_plugin.cc | |
parent | c0850719bc7d02985c98b3ecf6c0ec0b0acecacf (diff) | |
download | mariadb-git-1c94c8e674735337af6170cc21db3f685fe4e321.tar.gz |
Bug#31382
"Disabled plugin is provoking Valgrind error"
If there are any auto-alloced string plug-in options, memory is
allocated during the call for handle_options(). We must free this
memory if we are not installing the plug-in.
include/my_getopt.h:
bug31382
new function: my_cleanup_options()
mysys/my_getopt.c:
bug31382
new function: my_cleanup_options(), fini_one_value()
alter init_variables() to take an extra option.
forward declare init_one_value() and fini_one_value()
sql/sql_plugin.cc:
bug31382
after calling handle_options(), make sure to call my_cleanup_options()
if we are not installing the plug-in.
Diffstat (limited to 'sql/sql_plugin.cc')
-rw-r--r-- | sql/sql_plugin.cc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 2d33da29b77..2970ce1d11f 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -3092,7 +3092,7 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp, { sql_print_error("Parsing options for plugin '%s' failed.", tmp->name.str); - DBUG_RETURN(error); + goto err; } } @@ -3102,6 +3102,8 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp, *enabled= TRUE; } + error= 1; + if (*enabled) { for (opt= tmp->plugin->system_vars; opt && *opt; opt++) @@ -3140,7 +3142,7 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp, { sql_print_error("Plugin '%s' has conflicting system variables", tmp->name.str); - DBUG_RETURN(1); + goto err; } tmp->system_vars= chain.first; } @@ -3150,7 +3152,9 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp, if (enabled_saved && global_system_variables.log_warnings) sql_print_information("Plugin '%s' disabled by command line option", tmp->name.str); - DBUG_RETURN(1); +err: + my_cleanup_options(opts); + DBUG_RETURN(error); } |