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

fix a memory leak in dbug

This commit is contained in:
Sergei Golubchik
2012-03-24 21:51:10 +01:00
parent 99aa3d465e
commit 6f79b3fa83

View File

@@ -1624,7 +1624,7 @@ static void FreeState(CODE_STATE *cs, int free_state)
*/ */
void _db_end_() void _db_end_()
{ {
CODE_STATE *cs; CODE_STATE *cs, dummy_cs;
/* /*
Set _dbug_on_ to be able to do full reset even when DEBUGGER_OFF was Set _dbug_on_ to be able to do full reset even when DEBUGGER_OFF was
called after dbug was initialized called after dbug was initialized
@@ -1633,8 +1633,18 @@ void _db_end_()
cs= code_state(); cs= code_state();
if (cs) if (cs)
{
while (cs->stack && cs->stack != &init_settings) while (cs->stack && cs->stack != &init_settings)
FreeState(cs, 1); FreeState(cs, 1);
}
else
{
cs= &dummy_cs;
bzero(cs, sizeof(*cs));
}
cs->stack= &init_settings;
FreeState(cs, 0);
} }