Browse Source

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.
pull/2145/head
Monty 4 years ago
parent
commit
392e744aec
  1. 5
      dbug/dbug.c

5
dbug/dbug.c

@ -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)
{

Loading…
Cancel
Save