Commit 57ba177d authored by Nirbhay Choubey's avatar Nirbhay Choubey

MDEV#5812 Memory leaks while running mysqld in

bootstrap mode

Added calls to deinit functions at appropriate
places.
parent 653ef223
......@@ -96,6 +96,11 @@ static struct my_option my_long_options[] =
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
void cleanup_and_exit(int exit_code)
{
my_end(0);
exit(exit_code);
}
static void usage(my_bool version)
{
......@@ -110,7 +115,7 @@ static void usage(my_bool version)
my_print_default_files(config_file);
my_print_variables(my_long_options);
printf("\nExample usage:\n%s --defaults-file=example.cnf client client-server mysql\n", my_progname);
exit(0);
cleanup_and_exit(0);
}
......@@ -123,7 +128,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
opt_defaults_file_used= 1;
break;
case 'n':
exit(0);
cleanup_and_exit(0);
case 'I':
case '?':
usage(0);
......@@ -172,7 +177,7 @@ int main(int argc, char **argv)
/* Check out the args */
if (get_options(&argc,&argv))
exit(1);
cleanup_and_exit(1);
nargs= argc + 1;
if (opt_mysqld)
......
......@@ -1868,6 +1868,10 @@ extern "C" void unireg_abort(int exit_code)
wsrep_close_threads(thd); /* this won't close all threads */
sleep(1); /* so give some time to exit for those which can */
WSREP_INFO("Some threads may fail to exit.");
/* In bootstrap mode we deinitialize wsrep here. */
if (opt_bootstrap && wsrep_inited)
wsrep_deinit();
}
#endif // WITH_WSREP
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment