Commit 6f79b3fa authored by Sergei Golubchik's avatar Sergei Golubchik

fix a memory leak in dbug

parent 99aa3d46
...@@ -1624,7 +1624,7 @@ static void FreeState(CODE_STATE *cs, int free_state) ...@@ -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_() ...@@ -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);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment