Commit 392e744a authored by Monty's avatar Monty

Fixed crashing when using DBUG_PUSH_EMPTY

DBUG_PUSH_EMPTY is used by thr_mutex.cc.
If there are 4G of DBUG_PUSH_EMPTY calls, then DBUG_POP_EMPTY will
cause a crash when DBUGCloseFile() will try to free an object that
was never allocated.
parent 099b9202
......@@ -1994,11 +1994,10 @@ static void DBUGOpenFile(CODE_STATE *cs,
static void DBUGCloseFile(CODE_STATE *cs, sFILE *new_value)
{
sFILE *fp;
if (!cs || !cs->stack || !cs->stack->out_file)
if (!cs || !cs->stack || !(fp= cs->stack->out_file))
return;
fp= cs->stack->out_file;
if (--fp->used == 0)
if (fp != sstdout && fp != sstderr && --fp->used == 0)
{
if (fclose(fp->file) == EOF)
{
......
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