mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 20:20:07 +00:00
app_morsecode: Fix deadlock
Fixes a deadlock in app_morsecode caused by locking the channel twice when reading variables from the channel. The duplicate lock is simply removed. ASTERISK-29744 #close Change-Id: I204000701f123361d7f85e0498fedc90243c75e4
This commit is contained in:
committed by
Kevin Harwell
parent
ac2c984f22
commit
a9e2d9b5f1
@@ -197,14 +197,12 @@ static int morsecode_exec(struct ast_channel *chan, const char *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Use variable MORSETONE, if set (else 800) */
|
/* Use variable MORSETONE, if set (else 800) */
|
||||||
ast_channel_lock(chan);
|
|
||||||
tonec = pbx_builtin_getvar_helper(chan, "MORSETONE");
|
tonec = pbx_builtin_getvar_helper(chan, "MORSETONE");
|
||||||
if (ast_strlen_zero(tonec) || (sscanf(tonec, "%30d", &tone) != 1)) {
|
if (ast_strlen_zero(tonec) || (sscanf(tonec, "%30d", &tone) != 1)) {
|
||||||
tone = 800;
|
tone = 800;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Use variable MORSESPACETONE, if set (else 0) */
|
/* Use variable MORSESPACETONE, if set (else 0) */
|
||||||
|
|
||||||
toneb = pbx_builtin_getvar_helper(chan, "MORSESPACETONE");
|
toneb = pbx_builtin_getvar_helper(chan, "MORSESPACETONE");
|
||||||
if (ast_strlen_zero(toneb) || (sscanf(toneb, "%30d", &toneoff) != 1)) {
|
if (ast_strlen_zero(toneb) || (sscanf(toneb, "%30d", &toneoff) != 1)) {
|
||||||
toneoff = 0;
|
toneoff = 0;
|
||||||
@@ -216,8 +214,8 @@ static int morsecode_exec(struct ast_channel *chan, const char *data)
|
|||||||
codetype = "INTERNATIONAL";
|
codetype = "INTERNATIONAL";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ast_channel_unlock(chan);
|
||||||
if (!strcmp(codetype, "AMERICAN")) {
|
if (!strcmp(codetype, "AMERICAN")) {
|
||||||
ast_channel_unlock(chan);
|
|
||||||
for (digit = data; *digit; digit++) {
|
for (digit = data; *digit; digit++) {
|
||||||
const char *dahdit;
|
const char *dahdit;
|
||||||
digit2 = *digit;
|
digit2 = *digit;
|
||||||
@@ -252,7 +250,6 @@ static int morsecode_exec(struct ast_channel *chan, const char *data)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else { /* International */
|
} else { /* International */
|
||||||
ast_channel_unlock(chan);
|
|
||||||
for (digit = data; *digit; digit++) {
|
for (digit = data; *digit; digit++) {
|
||||||
const char *dahdit;
|
const char *dahdit;
|
||||||
digit2 = *digit;
|
digit2 = *digit;
|
||||||
|
Reference in New Issue
Block a user