[svn-commits] igorg: branch 12 r426667 - in /branches/12: ./ channels/chan_unistim.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Oct 30 01:02:15 CDT 2014


Author: igorg
Date: Thu Oct 30 01:02:10 2014
New Revision: 426667

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=426667
Log:

Add additional checks for NULL pointers to fix several crashes reported.

ASTERISK-24304 #close
Reported by: dhanapathy sathya
........

Merged revisions 426666 from http://svn.asterisk.org/svn/asterisk/branches/11

Modified:
    branches/12/   (props changed)
    branches/12/channels/chan_unistim.c

Propchange: branches/12/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.

Modified: branches/12/channels/chan_unistim.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/channels/chan_unistim.c?view=diff&rev=426667&r1=426666&r2=426667
==============================================================================
--- branches/12/channels/chan_unistim.c (original)
+++ branches/12/channels/chan_unistim.c Thu Oct 30 01:02:10 2014
@@ -2516,6 +2516,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_lock(chan);
 	ast_channel_exten_set(chan, s->device->phone_number);
@@ -3283,6 +3286,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 = '#';
@@ -3296,7 +3302,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);
 			}
@@ -3338,8 +3344,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 svn-commits mailing list