Skip to content

Commit ad67f69

Browse files
InterLinked1Friendly Automation
authored andcommitted
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
1 parent 2320a96 commit ad67f69

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

apps/app_morsecode.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,14 +197,12 @@ static int morsecode_exec(struct ast_channel *chan, const char *data)
197197
}
198198

199199
/* Use variable MORSETONE, if set (else 800) */
200-
ast_channel_lock(chan);
201200
tonec = pbx_builtin_getvar_helper(chan, "MORSETONE");
202201
if (ast_strlen_zero(tonec) || (sscanf(tonec, "%30d", &tone) != 1)) {
203202
tone = 800;
204203
}
205204

206205
/* Use variable MORSESPACETONE, if set (else 0) */
207-
208206
toneb = pbx_builtin_getvar_helper(chan, "MORSESPACETONE");
209207
if (ast_strlen_zero(toneb) || (sscanf(toneb, "%30d", &toneoff) != 1)) {
210208
toneoff = 0;
@@ -216,8 +214,8 @@ static int morsecode_exec(struct ast_channel *chan, const char *data)
216214
codetype = "INTERNATIONAL";
217215
}
218216

217+
ast_channel_unlock(chan);
219218
if (!strcmp(codetype, "AMERICAN")) {
220-
ast_channel_unlock(chan);
221219
for (digit = data; *digit; digit++) {
222220
const char *dahdit;
223221
digit2 = *digit;
@@ -252,7 +250,6 @@ static int morsecode_exec(struct ast_channel *chan, const char *data)
252250
break;
253251
}
254252
} else { /* International */
255-
ast_channel_unlock(chan);
256253
for (digit = data; *digit; digit++) {
257254
const char *dahdit;
258255
digit2 = *digit;

0 commit comments

Comments
 (0)