aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_agent.c
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2008-09-19 15:43:28 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2008-09-19 15:43:28 +0000
commit13f00c1f2bedf47d27868faa827ec7557d82e212 (patch)
tree5c58535d7acba9e1ea944e6942f5d0df00edd05d /channels/chan_agent.c
parentd40eb60d1b4363dcb77f240e7490f42bfc46238d (diff)
We should only unsubscribe to the device state event
subscription if we have previously subscribed. Otherwise a segfault will occur. (closes issue #13476) Reported by: jonnt Patches: 13476.patch uploaded by putnopvut (license 60) Tested by: jonnt git-svn-id: http://svn.digium.com/svn/asterisk/trunk@143609 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_agent.c')
-rw-r--r--channels/chan_agent.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/channels/chan_agent.c b/channels/chan_agent.c
index 83dbd38e4..f84c0f011 100644
--- a/channels/chan_agent.c
+++ b/channels/chan_agent.c
@@ -2535,7 +2535,9 @@ static int unload_module(void)
/* First, take us out of the channel loop */
ast_channel_unregister(&agent_tech);
/* Delete devicestate subscription */
- agent_devicestate_sub = ast_event_unsubscribe(agent_devicestate_sub);
+ if (agent_devicestate_sub) {
+ agent_devicestate_sub = ast_event_unsubscribe(agent_devicestate_sub);
+ }
/* Unregister dialplan functions */
ast_custom_function_unregister(&agent_function);
/* Unregister CLI commands */