From a046322b4e61aaef3db9efc9e85477792085c453 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 15 May 2006 18:07:18 +0200 Subject: Fix two Valgrind memory leak warnings. client/mysqlbinlog.cc: Now my_end() deallocates DBUG by default, but that fails in mysqlbinlog because of global destructors that use DBUG. dbug/dbug.c: Add a facility to deallocate the debug stack, to avoid memory leak warnings in Valgrind. include/my_dbug.h: Add a facility to deallocate the debug stack, to avoid memory leak warnings in Valgrind. include/my_sys.h: Change my_end() to deallocate DBUG memory by default (can be disabled with MY_DONT_FREE_DBUG option). libmysql/libmysql.c: Do not deallocate DBUG during cleanup. mysys/my_init.c: Change my_end() to deallocate DBUG memory by default (can be disabled with MY_DONT_FREE_DBUG option). sql/mysqld.cc: Add missing my_thread_end() call, seems to occasionally trigger a memory leak (not repeatable). --- client/mysqlbinlog.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'client/mysqlbinlog.cc') diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index b1a931a9df1..60b54a2ed99 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -788,7 +788,8 @@ static void die(const char* fmt, ...) fprintf(stderr, "\n"); va_end(args); cleanup(); - my_end(0); + /* We cannot free DBUG, it is used in global destructors after exit(). */ + my_end(MY_DONT_FREE_DBUG); exit(1); } @@ -1460,7 +1461,8 @@ int main(int argc, char** argv) cleanup(); free_defaults(defaults_argv); my_free_open_file_info(); - my_end(0); + /* We cannot free DBUG, it is used in global destructors after exit(). */ + my_end(MY_DONT_FREE_DBUG); exit(exit_value); DBUG_RETURN(exit_value); // Keep compilers happy } -- cgit v1.2.1