Loading client/mysqlbinlog.cc +4 −2 Original line number Diff line number Diff line Loading @@ -815,7 +815,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); } Loading Loading @@ -1487,7 +1488,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 } Loading dbug/dbug.c +71 −13 Original line number Diff line number Diff line Loading @@ -255,6 +255,8 @@ static void DBUGOpenFile(CODE_STATE *,const char *, const char *, int); static void DBUGCloseFile(CODE_STATE *cs, FILE *fp); /* Push current debug settings */ static void PushState(CODE_STATE *cs); /* Free memory associated with debug state. */ static void FreeState (CODE_STATE *cs, struct settings *state); /* Test for tracing enabled */ static BOOLEAN DoTrace(CODE_STATE *cs); Loading Loading @@ -742,19 +744,7 @@ void _db_pop_() if (discard->next != NULL) { cs->stack= discard->next; if (!is_shared(discard, keywords)) FreeList(discard->keywords); if (!is_shared(discard, functions)) FreeList(discard->functions); if (!is_shared(discard, processes)) FreeList(discard->processes); if (!is_shared(discard, p_functions)) FreeList(discard->p_functions); if (!is_shared(discard, out_file)) DBUGCloseFile(cs, discard->out_file); if (discard->prof_file) DBUGCloseFile(cs, discard->prof_file); free((char *) discard); FreeState(cs, discard); } } Loading Loading @@ -1425,6 +1415,74 @@ static void PushState(CODE_STATE *cs) cs->stack= new_malloc; } /* * FUNCTION * * FreeState Free memory associated with a struct state. * * SYNOPSIS * * static void FreeState (state) * struct state *state; * * DESCRIPTION * * Deallocates the memory allocated for various information in a * state. * */ static void FreeState ( CODE_STATE *cs, struct settings *state) { if (!is_shared(state, keywords)) FreeList(state->keywords); if (!is_shared(state, functions)) FreeList(state->functions); if (!is_shared(state, processes)) FreeList(state->processes); if (!is_shared(state, p_functions)) FreeList(state->p_functions); if (!is_shared(state, out_file)) DBUGCloseFile(cs, state->out_file); if (state->prof_file) DBUGCloseFile(cs, state->prof_file); free((char *) state); } /* * FUNCTION * * _db_end_ End debugging, freeing state stack memory. * * SYNOPSIS * * static VOID _db_end_ () * * DESCRIPTION * * Ends debugging, de-allocating the memory allocated to the * state stack. * * To be called at the very end of the program. * */ void _db_end_ () { struct settings *discard; CODE_STATE *cs=0; get_code_state_or_return; while((discard= cs->stack) != NULL) { if(discard == &init_settings) break; cs->stack= discard->next; FreeState (cs, discard); } } /* * FUNCTION Loading include/my_dbug.h +3 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ extern void _db_pargs_(uint _line_,const char *keyword); extern void _db_doprnt_ _VARARGS((const char *format,...)); extern void _db_dump_(uint _line_,const char *keyword,const char *memory, uint length); extern void _db_end_(void); extern void _db_lock_file_(void); extern void _db_unlock_file_(void); extern FILE *_db_fp_(void); Loading Loading @@ -73,6 +74,7 @@ extern FILE *_db_fp_(void); #define DBUG_SETJMP(a1) (_db_setjmp_ (), setjmp (a1)) #define DBUG_LONGJMP(a1,a2) (_db_longjmp_ (), longjmp (a1, a2)) #define DBUG_DUMP(keyword,a1,a2) _db_dump_(__LINE__,keyword,a1,a2) #define DBUG_END() _db_end_ () #define DBUG_LOCK_FILE _db_lock_file_() #define DBUG_UNLOCK_FILE _db_unlock_file_() #define DBUG_ASSERT(A) assert(A) Loading @@ -97,6 +99,7 @@ extern FILE *_db_fp_(void); #define DBUG_SETJMP(a1) setjmp(a1) #define DBUG_LONGJMP(a1) longjmp(a1) #define DBUG_DUMP(keyword,a1,a2) #define DBUG_END() #define DBUG_ASSERT(A) #define DBUG_LOCK_FILE #define DBUG_FILE (stderr) Loading include/my_sys.h +1 −0 Original line number Diff line number Diff line Loading @@ -75,6 +75,7 @@ extern int NEAR my_errno; /* Last error in mysys */ #define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */ #define MY_GIVE_INFO 2 /* Give time info about process*/ #define MY_DONT_FREE_DBUG 4 /* Do not call DBUG_END() in my_end() */ #define ME_HIGHBYTE 8 /* Shift for colours */ #define ME_NOCUR 1 /* Don't use curses message */ Loading libmysql/libmysql.c +1 −1 Original line number Diff line number Diff line Loading @@ -178,7 +178,7 @@ void STDCALL mysql_server_end() /* If library called my_init(), free memory allocated by it */ if (!org_my_init_done) { my_end(0); my_end(MY_DONT_FREE_DBUG); /* Remove TRACING, if enabled by mysql_debug() */ DBUG_POP(); } Loading Loading
client/mysqlbinlog.cc +4 −2 Original line number Diff line number Diff line Loading @@ -815,7 +815,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); } Loading Loading @@ -1487,7 +1488,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 } Loading
dbug/dbug.c +71 −13 Original line number Diff line number Diff line Loading @@ -255,6 +255,8 @@ static void DBUGOpenFile(CODE_STATE *,const char *, const char *, int); static void DBUGCloseFile(CODE_STATE *cs, FILE *fp); /* Push current debug settings */ static void PushState(CODE_STATE *cs); /* Free memory associated with debug state. */ static void FreeState (CODE_STATE *cs, struct settings *state); /* Test for tracing enabled */ static BOOLEAN DoTrace(CODE_STATE *cs); Loading Loading @@ -742,19 +744,7 @@ void _db_pop_() if (discard->next != NULL) { cs->stack= discard->next; if (!is_shared(discard, keywords)) FreeList(discard->keywords); if (!is_shared(discard, functions)) FreeList(discard->functions); if (!is_shared(discard, processes)) FreeList(discard->processes); if (!is_shared(discard, p_functions)) FreeList(discard->p_functions); if (!is_shared(discard, out_file)) DBUGCloseFile(cs, discard->out_file); if (discard->prof_file) DBUGCloseFile(cs, discard->prof_file); free((char *) discard); FreeState(cs, discard); } } Loading Loading @@ -1425,6 +1415,74 @@ static void PushState(CODE_STATE *cs) cs->stack= new_malloc; } /* * FUNCTION * * FreeState Free memory associated with a struct state. * * SYNOPSIS * * static void FreeState (state) * struct state *state; * * DESCRIPTION * * Deallocates the memory allocated for various information in a * state. * */ static void FreeState ( CODE_STATE *cs, struct settings *state) { if (!is_shared(state, keywords)) FreeList(state->keywords); if (!is_shared(state, functions)) FreeList(state->functions); if (!is_shared(state, processes)) FreeList(state->processes); if (!is_shared(state, p_functions)) FreeList(state->p_functions); if (!is_shared(state, out_file)) DBUGCloseFile(cs, state->out_file); if (state->prof_file) DBUGCloseFile(cs, state->prof_file); free((char *) state); } /* * FUNCTION * * _db_end_ End debugging, freeing state stack memory. * * SYNOPSIS * * static VOID _db_end_ () * * DESCRIPTION * * Ends debugging, de-allocating the memory allocated to the * state stack. * * To be called at the very end of the program. * */ void _db_end_ () { struct settings *discard; CODE_STATE *cs=0; get_code_state_or_return; while((discard= cs->stack) != NULL) { if(discard == &init_settings) break; cs->stack= discard->next; FreeState (cs, discard); } } /* * FUNCTION Loading
include/my_dbug.h +3 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ extern void _db_pargs_(uint _line_,const char *keyword); extern void _db_doprnt_ _VARARGS((const char *format,...)); extern void _db_dump_(uint _line_,const char *keyword,const char *memory, uint length); extern void _db_end_(void); extern void _db_lock_file_(void); extern void _db_unlock_file_(void); extern FILE *_db_fp_(void); Loading Loading @@ -73,6 +74,7 @@ extern FILE *_db_fp_(void); #define DBUG_SETJMP(a1) (_db_setjmp_ (), setjmp (a1)) #define DBUG_LONGJMP(a1,a2) (_db_longjmp_ (), longjmp (a1, a2)) #define DBUG_DUMP(keyword,a1,a2) _db_dump_(__LINE__,keyword,a1,a2) #define DBUG_END() _db_end_ () #define DBUG_LOCK_FILE _db_lock_file_() #define DBUG_UNLOCK_FILE _db_unlock_file_() #define DBUG_ASSERT(A) assert(A) Loading @@ -97,6 +99,7 @@ extern FILE *_db_fp_(void); #define DBUG_SETJMP(a1) setjmp(a1) #define DBUG_LONGJMP(a1) longjmp(a1) #define DBUG_DUMP(keyword,a1,a2) #define DBUG_END() #define DBUG_ASSERT(A) #define DBUG_LOCK_FILE #define DBUG_FILE (stderr) Loading
include/my_sys.h +1 −0 Original line number Diff line number Diff line Loading @@ -75,6 +75,7 @@ extern int NEAR my_errno; /* Last error in mysys */ #define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */ #define MY_GIVE_INFO 2 /* Give time info about process*/ #define MY_DONT_FREE_DBUG 4 /* Do not call DBUG_END() in my_end() */ #define ME_HIGHBYTE 8 /* Shift for colours */ #define ME_NOCUR 1 /* Don't use curses message */ Loading
libmysql/libmysql.c +1 −1 Original line number Diff line number Diff line Loading @@ -178,7 +178,7 @@ void STDCALL mysql_server_end() /* If library called my_init(), free memory allocated by it */ if (!org_my_init_done) { my_end(0); my_end(MY_DONT_FREE_DBUG); /* Remove TRACING, if enabled by mysql_debug() */ DBUG_POP(); } Loading