Skip to content

Commit 9aa9f56

Browse files
committed
res_alarmsystem: Add missing return.
A missing return caused us to continue executing with a NULL channel, causing a segfault. The executed code should not have been run; we now return immediately in this case. PHREAKSCRIPT-57 #close
1 parent 2c33640 commit 9aa9f56

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

res/res_alarmsystem.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1398,7 +1398,11 @@ static int wait_for_answer(struct alarm_client *c)
13981398
/*! \brief Send a DTMF string, optionally *-terminated */
13991399
static int send_dtmf(struct ast_channel *chan, const char *digits, int addstar)
14001400
{
1401-
int res = ast_dtmf_stream(chan, NULL, digits, 150, 100);
1401+
int res;
1402+
1403+
ast_assert(chan != NULL);
1404+
1405+
res = ast_dtmf_stream(chan, NULL, digits, 150, 100);
14021406
if (res) {
14031407
ast_log(LOG_WARNING, "Failed to send digits '%s'\n", digits);
14041408
return res;
@@ -1573,6 +1577,7 @@ static int send_events_to_server_by_phone(struct alarm_client *c)
15731577
/* Hang up the channel immediately, since it's unlikely to be needed soon */
15741578
ast_hangup(c->phonechan);
15751579
c->phonechan = NULL;
1580+
return 0;
15761581
}
15771582

15781583
/* Send a final # to indicate we're done, at least for now */

0 commit comments

Comments
 (0)