[Asterisk-code-review] app_morsecode: Fix deadlock (asterisk[master])
Friendly Automation
asteriskteam at digium.com
Tue Nov 16 16:49:17 CST 2021
Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/17469 )
Change subject: app_morsecode: Fix deadlock
......................................................................
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
---
M apps/app_morsecode.c
1 file changed, 1 insertion(+), 4 deletions(-)
Approvals:
Joshua Colp: Looks good to me, but someone else must approve
Kevin Harwell: Looks good to me, approved
Sean Bright: Looks good to me, but someone else must approve
Friendly Automation: Approved for Submit
diff --git a/apps/app_morsecode.c b/apps/app_morsecode.c
index 995eb70..f9b2119 100644
--- a/apps/app_morsecode.c
+++ b/apps/app_morsecode.c
@@ -197,14 +197,12 @@
}
/* Use variable MORSETONE, if set (else 800) */
- ast_channel_lock(chan);
tonec = pbx_builtin_getvar_helper(chan, "MORSETONE");
if (ast_strlen_zero(tonec) || (sscanf(tonec, "%30d", &tone) != 1)) {
tone = 800;
}
/* Use variable MORSESPACETONE, if set (else 0) */
-
toneb = pbx_builtin_getvar_helper(chan, "MORSESPACETONE");
if (ast_strlen_zero(toneb) || (sscanf(toneb, "%30d", &toneoff) != 1)) {
toneoff = 0;
@@ -216,8 +214,8 @@
codetype = "INTERNATIONAL";
}
+ ast_channel_unlock(chan);
if (!strcmp(codetype, "AMERICAN")) {
- ast_channel_unlock(chan);
for (digit = data; *digit; digit++) {
const char *dahdit;
digit2 = *digit;
@@ -252,7 +250,6 @@
break;
}
} else { /* International */
- ast_channel_unlock(chan);
for (digit = data; *digit; digit++) {
const char *dahdit;
digit2 = *digit;
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/17469
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I204000701f123361d7f85e0498fedc90243c75e4
Gerrit-Change-Number: 17469
Gerrit-PatchSet: 3
Gerrit-Owner: N A <mail at interlinked.x10host.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Sean Bright <sean at seanbright.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20211116/9f91fe26/attachment.html>
More information about the asterisk-code-review
mailing list