1
0
mirror of https://github.com/MariaDB/server.git synced 2026-10-23 18:49:29 +03:00

MDEV#5812 Memory leaks while running mysqld in

bootstrap mode

Added calls to deinit functions at appropriate
places.
This commit is contained in:
Nirbhay Choubey
2014-03-11 23:12:18 -04:00
parent 653ef22336
commit 57ba177daf
2 changed files with 12 additions and 3 deletions

View File

@@ -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)

View File

@@ -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