Report memory leaks from mariadbd if -T or --debug is used

Before memory leaks was only reported if server stopped normally.
This made it harder to find out where the leaks happened when
debugging test cases.
This commit is contained in:
Monty 2020-08-17 19:05:10 +03:00 committed by Sergei Golubchik
commit 942a5a89a9

View file

@ -1863,7 +1863,7 @@ static void mysqld_exit(int exit_code)
{ {
fprintf(stderr, "Warning: Memory not freed: %lld\n", fprintf(stderr, "Warning: Memory not freed: %lld\n",
(longlong) global_status_var.global_memory_used); (longlong) global_status_var.global_memory_used);
if (exit_code == 0) if (exit_code == 0 || opt_endinfo)
SAFEMALLOC_REPORT_MEMORY(0); SAFEMALLOC_REPORT_MEMORY(0);
} }
DBUG_LEAVE; DBUG_LEAVE;