|
36 | 36 | #include "my_base.h"
|
37 | 37 | #include "my_compiler.h"
|
38 | 38 | #include "my_dbug.h"
|
39 |
| -#include "my_default.h" // free_defaults |
40 | 39 | #include "my_getopt.h"
|
41 | 40 | #include "my_inttypes.h"
|
42 | 41 | #include "my_list.h"
|
@@ -2239,8 +2238,9 @@ static bool mysql_install_plugin(THD *thd, LEX_CSTRING name,
|
2239 | 2238 | const LEX_STRING *dl) {
|
2240 | 2239 | TABLE *table;
|
2241 | 2240 | bool error = true;
|
2242 |
| - int argc = orig_argc; |
2243 |
| - char **argv = orig_argv; |
| 2241 | + int argc; |
| 2242 | + char **argv; |
| 2243 | + char **argv_copy; |
2244 | 2244 | st_plugin_int *tmp = nullptr;
|
2245 | 2245 | bool store_infoschema_metadata = false;
|
2246 | 2246 | dd::Schema_MDL_locker mdl_handler(thd);
|
@@ -2312,16 +2312,18 @@ static bool mysql_install_plugin(THD *thd, LEX_CSTRING name,
|
2312 | 2312 | mysql_mutex_lock(&LOCK_plugin);
|
2313 | 2313 |
|
2314 | 2314 | {
|
2315 |
| - MEM_ROOT alloc{PSI_NOT_INSTRUMENTED, 512}; |
2316 |
| - my_getopt_use_args_separator = true; |
2317 |
| - if (my_load_defaults(MYSQL_CONFIG_NAME, load_default_groups, &argc, &argv, |
2318 |
| - &alloc, nullptr)) { |
| 2315 | + argc = argc_cached; |
| 2316 | + if (!(argv_copy = |
| 2317 | + (char **)my_memdup(PSI_NOT_INSTRUMENTED, argv_cached, |
| 2318 | + (argc + 1) * sizeof(char *), MYF(0)))) { |
2319 | 2319 | mysql_mutex_unlock(&LOCK_plugin);
|
2320 | 2320 | mysql_rwlock_unlock(&LOCK_system_variables_hash);
|
2321 |
| - report_error(REPORT_TO_USER, ER_PLUGIN_IS_NOT_LOADED, name.str); |
| 2321 | + report_error(REPORT_TO_USER, ER_OUTOFMEMORY, |
| 2322 | + static_cast<int>((argc + 1) * sizeof(char *))); |
2322 | 2323 | goto err;
|
2323 | 2324 | }
|
2324 |
| - my_getopt_use_args_separator = false; |
| 2325 | + argv = argv_copy; |
| 2326 | + |
2325 | 2327 | /*
|
2326 | 2328 | Append parse early and static variables present in mysqld-auto.cnf file
|
2327 | 2329 | for the newly installed plugin to process those options which are specific
|
@@ -2457,6 +2459,7 @@ static bool mysql_install_plugin(THD *thd, LEX_CSTRING name,
|
2457 | 2459 | }
|
2458 | 2460 |
|
2459 | 2461 | err:
|
| 2462 | + my_free(argv_copy); |
2460 | 2463 | mysql_mutex_unlock(&LOCK_plugin_install);
|
2461 | 2464 | return end_transaction(thd, error);
|
2462 | 2465 | }
|
|
0 commit comments