1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

less memory-leak-on-exit reports for clients

mysqltest cannot free all memory on exit by design,
so there's no need to check.

mysql frees memory in mysql_end(), so enable memory-leak-on-exit check
only after it was initialized enough to use  mysql_end() - early exits
use my_end().
This commit is contained in:
Sergei Golubchik
2018-02-02 11:38:39 +01:00
parent d94d937d1c
commit bd0eb2bdd7
2 changed files with 2 additions and 7 deletions

View File

@@ -1140,6 +1140,7 @@ int main(int argc,char *argv[])
current_prompt = my_strdup(default_prompt,MYF(MY_WME)); current_prompt = my_strdup(default_prompt,MYF(MY_WME));
prompt_counter=0; prompt_counter=0;
aborted= 0; aborted= 0;
sf_leaking_memory= 1; /* no memory leak reports yet */
outfile[0]=0; // no (default) outfile outfile[0]=0; // no (default) outfile
strmov(pager, "stdout"); // the default, if --pager wasn't given strmov(pager, "stdout"); // the default, if --pager wasn't given
@@ -1200,6 +1201,7 @@ int main(int argc,char *argv[])
my_end(0); my_end(0);
exit(1); exit(1);
} }
sf_leaking_memory= 0;
glob_buffer.realloc(512); glob_buffer.realloc(512);
completion_hash_init(&ht, 128); completion_hash_init(&ht, 128);
init_alloc_root(&hash_mem_root, 16384, 0, MYF(0)); init_alloc_root(&hash_mem_root, 16384, 0, MYF(0));
@@ -1795,10 +1797,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib, if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib,
opt->name)) <= 0) opt->name)) <= 0)
{
sf_leaking_memory= 1; /* no memory leak reports here */
exit(1); exit(1);
}
#endif #endif
break; break;
case OPT_SERVER_ARG: case OPT_SERVER_ARG:

View File

@@ -1523,7 +1523,6 @@ static void cleanup_and_exit(int exit_code)
} }
} }
sf_leaking_memory= 0; /* all memory should be freed by now */
exit(exit_code); exit(exit_code);
} }
@@ -7294,10 +7293,7 @@ get_one_option(int optid, const struct my_option *opt, char *argument)
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib, if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib,
opt->name)) <= 0) opt->name)) <= 0)
{
sf_leaking_memory= 1; /* no memory leak reports here */
exit(1); exit(1);
}
#endif #endif
break; break;
case '?': case '?':