|
38 | 38 | #include "my_base.h"
|
39 | 39 | #include "my_compiler.h"
|
40 | 40 | #include "my_dbug.h"
|
41 |
| -#include "my_default.h" // free_defaults |
42 | 41 | #include "my_getopt.h"
|
43 | 42 | #include "my_inttypes.h"
|
44 | 43 | #include "my_list.h"
|
@@ -2254,8 +2253,9 @@ static bool mysql_install_plugin(THD *thd, LEX_CSTRING name,
|
2254 | 2253 | const LEX_STRING *dl) {
|
2255 | 2254 | TABLE *table;
|
2256 | 2255 | bool error = true;
|
2257 |
| - int argc = orig_argc; |
2258 |
| - char **argv = orig_argv; |
| 2256 | + int argc; |
| 2257 | + char **argv; |
| 2258 | + char **argv_copy; |
2259 | 2259 | st_plugin_int *tmp = nullptr;
|
2260 | 2260 | bool store_infoschema_metadata = false;
|
2261 | 2261 | dd::Schema_MDL_locker mdl_handler(thd);
|
@@ -2327,16 +2327,18 @@ static bool mysql_install_plugin(THD *thd, LEX_CSTRING name,
|
2327 | 2327 | mysql_mutex_lock(&LOCK_plugin);
|
2328 | 2328 |
|
2329 | 2329 | {
|
2330 |
| - MEM_ROOT alloc{PSI_NOT_INSTRUMENTED, 512}; |
2331 |
| - my_getopt_use_args_separator = true; |
2332 |
| - if (my_load_defaults(MYSQL_CONFIG_NAME, load_default_groups, &argc, &argv, |
2333 |
| - &alloc, nullptr)) { |
| 2330 | + argc = argc_cached; |
| 2331 | + if (!(argv_copy = |
| 2332 | + (char **)my_memdup(PSI_NOT_INSTRUMENTED, argv_cached, |
| 2333 | + (argc + 1) * sizeof(char *), MYF(0)))) { |
2334 | 2334 | mysql_mutex_unlock(&LOCK_plugin);
|
2335 | 2335 | mysql_rwlock_unlock(&LOCK_system_variables_hash);
|
2336 |
| - report_error(REPORT_TO_USER, ER_PLUGIN_IS_NOT_LOADED, name.str); |
| 2336 | + report_error(REPORT_TO_USER, ER_OUTOFMEMORY, |
| 2337 | + static_cast<int>((argc + 1) * sizeof(char *))); |
2337 | 2338 | goto err;
|
2338 | 2339 | }
|
2339 |
| - my_getopt_use_args_separator = false; |
| 2340 | + argv = argv_copy; |
| 2341 | + |
2340 | 2342 | /*
|
2341 | 2343 | Append parse early and static variables present in mysqld-auto.cnf file
|
2342 | 2344 | for the newly installed plugin to process those options which are specific
|
@@ -2472,6 +2474,7 @@ static bool mysql_install_plugin(THD *thd, LEX_CSTRING name,
|
2472 | 2474 | }
|
2473 | 2475 |
|
2474 | 2476 | err:
|
| 2477 | + my_free(argv_copy); |
2475 | 2478 | mysql_mutex_unlock(&LOCK_plugin_install);
|
2476 | 2479 | return end_transaction(thd, error);
|
2477 | 2480 | }
|
|
0 commit comments