Skip to content

Commit

Permalink
MDEV-22950 : fix race condition in dbug
Browse files Browse the repository at this point in the history
FreeState() zeros init_settings.out_file, which another thread can be using
  • Loading branch information
vaintroub committed Jun 19, 2020
1 parent 26907e7 commit 727252f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dbug/dbug.c
Original file line number Diff line number Diff line change
Expand Up @@ -483,17 +483,17 @@ static int DbugParse(CODE_STATE *cs, const char *control)
rel= control[0] == '+' || control[0] == '-';
if ((!rel || (!stack->out_file && !stack->next)))
{
LockIfInitSettings(cs);
FreeState(cs, 0);
stack->flags= 0;
stack->delay= 0;
stack->maxdepth= 0;
stack->sub_level= 0;
stack->out_file= sstderr;
stack->functions= NULL;
LockIfInitSettings(cs);
stack->keywords= NULL;
UnlockIfInitSettings(cs);
stack->processes= NULL;
UnlockIfInitSettings(cs);
}
else if (!stack->out_file)
{
Expand Down

0 comments on commit 727252f

Please sign in to comment.