Commit 2f742b57 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-18376 Memory leak in main.mysqladmin

don't initialize mysql structure before it actually becomes needed.

This fixes main.mysqladmin failures
in ASAN_OPTIONS="abort_on_error=1" runs
parent 65070bef
...@@ -318,7 +318,6 @@ int main(int argc,char *argv[]) ...@@ -318,7 +318,6 @@ int main(int argc,char *argv[])
char **commands, **save_argv, **temp_argv; char **commands, **save_argv, **temp_argv;
MY_INIT(argv[0]); MY_INIT(argv[0]);
mysql_init(&mysql);
sf_leaking_memory=1; /* don't report memory leaks on early exits */ sf_leaking_memory=1; /* don't report memory leaks on early exits */
load_defaults_or_exit("my", load_default_groups, &argc, &argv); load_defaults_or_exit("my", load_default_groups, &argc, &argv);
save_argv = argv; /* Save for free_defaults */ save_argv = argv; /* Save for free_defaults */
...@@ -347,6 +346,7 @@ int main(int argc,char *argv[]) ...@@ -347,6 +346,7 @@ int main(int argc,char *argv[])
sf_leaking_memory=0; /* from now on we cleanup properly */ sf_leaking_memory=0; /* from now on we cleanup properly */
mysql_init(&mysql);
if (opt_compress) if (opt_compress)
mysql_options(&mysql,MYSQL_OPT_COMPRESS,NullS); mysql_options(&mysql,MYSQL_OPT_COMPRESS,NullS);
if (opt_connect_timeout) if (opt_connect_timeout)
......
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