Commit 727252ff authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MDEV-22950 : fix race condition in dbug

FreeState() zeros init_settings.out_file, which another thread can be using
parent 26907e7e
...@@ -483,6 +483,7 @@ static int DbugParse(CODE_STATE *cs, const char *control) ...@@ -483,6 +483,7 @@ static int DbugParse(CODE_STATE *cs, const char *control)
rel= control[0] == '+' || control[0] == '-'; rel= control[0] == '+' || control[0] == '-';
if ((!rel || (!stack->out_file && !stack->next))) if ((!rel || (!stack->out_file && !stack->next)))
{ {
LockIfInitSettings(cs);
FreeState(cs, 0); FreeState(cs, 0);
stack->flags= 0; stack->flags= 0;
stack->delay= 0; stack->delay= 0;
...@@ -490,10 +491,9 @@ static int DbugParse(CODE_STATE *cs, const char *control) ...@@ -490,10 +491,9 @@ static int DbugParse(CODE_STATE *cs, const char *control)
stack->sub_level= 0; stack->sub_level= 0;
stack->out_file= sstderr; stack->out_file= sstderr;
stack->functions= NULL; stack->functions= NULL;
LockIfInitSettings(cs);
stack->keywords= NULL; stack->keywords= NULL;
UnlockIfInitSettings(cs);
stack->processes= NULL; stack->processes= NULL;
UnlockIfInitSettings(cs);
} }
else if (!stack->out_file) else if (!stack->out_file)
{ {
......
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