[asterisk-commits] igorg: branch 11 r426666 - /branches/11/channels/chan_unistim.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Oct 30 00:56:30 CDT 2014
Author: igorg
Date: Thu Oct 30 00:56:23 2014
New Revision: 426666
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=426666
Log:
Add additional checks for NULL pointers to fix several crashes reported.
ASTERISK-24304 #close
Reported by: dhanapathy sathya
Modified:
branches/11/channels/chan_unistim.c
Modified: branches/11/channels/chan_unistim.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/channels/chan_unistim.c?view=diff&rev=426666&r1=426665&r2=426666
==============================================================================
--- branches/11/channels/chan_unistim.c (original)
+++ branches/11/channels/chan_unistim.c Thu Oct 30 00:56:23 2014
@@ -2550,6 +2550,9 @@
struct unistimsession *s = l->parent->session;
int res;
+ if (!s) {
+ return NULL;
+ }
ast_verb(3, "Starting switch on '%s@%s-%d' to %s\n", l->name, l->parent->name, sub->softkey, s->device->phone_number);
ast_channel_exten_set(chan, s->device->phone_number);
ast_copy_string(s->device->redial_number, s->device->phone_number,
@@ -3306,6 +3309,9 @@
struct unistim_subchannel *sub = get_sub(pte->device, SUB_REAL);
struct unistim_subchannel *sub_3way = get_sub(pte->device, SUB_THREEWAY);
+ if (!sub) {
+ return;
+ }
if ((keycode >= KEY_0) && (keycode <= KEY_SHARP)) {
if (keycode == KEY_SHARP) {
keycode = '#';
@@ -3319,7 +3325,7 @@
}
switch (keycode) {
case KEY_FUNC1:
- if (ast_channel_state(sub->owner) == AST_STATE_UP) {
+ if (sub->owner && ast_channel_state(sub->owner) == AST_STATE_UP) {
if (sub_3way) {
close_call(pte);
}
@@ -3361,8 +3367,8 @@
MUTE_OFF);
break;
case KEY_MUTE:
- if (!sub || !sub->owner) {
- ast_log(LOG_WARNING, "Unable to find subchannel for music on hold\n");
+ if (!sub->owner) {
+ ast_log(LOG_WARNING, "Unable to find channel for music on hold\n");
return;
}
if (!sub->moh) {
More information about the asterisk-commits
mailing list