summaryrefslogtreecommitdiff
path: root/channels/chan_unistim.c
diff options
context:
space:
mode:
authorIgor Goncharovskiy <igor.goncharovsky@gmail.com>2014-10-30 06:15:14 +0000
committerIgor Goncharovskiy <igor.goncharovsky@gmail.com>2014-10-30 06:15:14 +0000
commitc866ced76be5b441c82a6c36f445390ec9934b34 (patch)
tree7f2cc9ad64e616d3d3899cdae07899361080cc48 /channels/chan_unistim.c
parent0ddc3bde249bb69e5bf6696cb21c097e199e5241 (diff)
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 ........ Merged revisions 426667 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 426668 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@426669 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_unistim.c')
-rw-r--r--channels/chan_unistim.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/channels/chan_unistim.c b/channels/chan_unistim.c
index 91cc40259..3dca9e876 100644
--- a/channels/chan_unistim.c
+++ b/channels/chan_unistim.c
@@ -2634,6 +2634,9 @@ static void *unistim_ss(void *data)
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);
@@ -3404,6 +3407,9 @@ static void key_call(struct unistimsession *pte, char keycode)
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 = '#';
@@ -3417,7 +3423,7 @@ static void key_call(struct unistimsession *pte, char keycode)
}
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);
}