diff options
author | Vladislav Vaintroub <wlad@mariadb.com> | 2020-06-20 01:00:36 +0200 |
---|---|---|
committer | Vladislav Vaintroub <wlad@mariadb.com> | 2020-06-20 01:00:36 +0200 |
commit | 727252ff1bb65c7abddc5a9acb17304695c09265 (patch) | |
tree | 70fbcf106a75ec15d9d70621da33e3802580c08d /dbug | |
parent | 26907e7ef18964dad7b6b1fc19c7d1e65e915020 (diff) | |
download | mariadb-git-727252ff1bb65c7abddc5a9acb17304695c09265.tar.gz |
MDEV-22950 : fix race condition in dbug
FreeState() zeros init_settings.out_file, which another thread can be using
Diffstat (limited to 'dbug')
-rw-r--r-- | dbug/dbug.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/dbug/dbug.c b/dbug/dbug.c index 21f86ded0a5..b0e1b0eaae6 100644 --- a/dbug/dbug.c +++ b/dbug/dbug.c @@ -483,6 +483,7 @@ 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; @@ -490,10 +491,9 @@ static int DbugParse(CODE_STATE *cs, const char *control) 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) { |