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). --- mysys/my_init.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'mysys') diff --git a/mysys/my_init.c b/mysys/my_init.c index c2bfdde0ddd..9b8d4db172f 100644 --- a/mysys/my_init.c +++ b/mysys/my_init.c @@ -196,8 +196,10 @@ Voluntary context switches %ld, Involuntary context switches %ld\n", _CrtDumpMemoryLeaks(); #endif } + + if (!(infoflag & MY_DONT_FREE_DBUG)) + DBUG_END(); /* Must be done before my_thread_end */ #ifdef THREAD - DBUG_POP(); /* Must be done before my_thread_end */ my_thread_end(); my_thread_global_end(); #if defined(SAFE_MUTEX) -- cgit v1.2.1