diff options
author | Russell Bryant <russell@russellbryant.com> | 2007-06-19 15:27:16 +0000 |
---|---|---|
committer | Russell Bryant <russell@russellbryant.com> | 2007-06-19 15:27:16 +0000 |
commit | 238b7a54cc4bc49913cef4ae8cb4393d49d7946a (patch) | |
tree | 8cf0d352b25743801458a9f1395eb2d715421e50 | |
parent | f408a5405ad20868180f13b7db8c42811552d1b8 (diff) |
Merged revisions 69944 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r69944 | russell | 2007-06-19 10:22:36 -0500 (Tue, 19 Jun 2007) | 10 lines
Fix a crash that could occur when handing device state changes.
When the state of a device changes, the device state thread tells the extension
state handling code that it changed. Then, the extension state code calls the
callback in chan_sip so that it can update subscriptions to that extension.
A pointer to a sip_pvt structure is passed to this function as the call which
needs a NOTIFY sent. However, there was no locking done to ensure that the pvt
struct didn't disappear during this process.
(issue #9946, reported by tdonahue, patch by me, patch updated to trunk to use
the sip_pvt lock wrappers by eliel)
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@69945 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r-- | channels/chan_sip.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 991695d30..827728514 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -8824,6 +8824,8 @@ static int cb_extensionstate(char *context, char* exten, int state, void *data) { struct sip_pvt *p = data; + sip_pvt_lock(p); + switch(state) { case AST_EXTENSION_DEACTIVATED: /* Retry after a while */ case AST_EXTENSION_REMOVED: /* Extension is gone */ @@ -8844,6 +8846,9 @@ static int cb_extensionstate(char *context, char* exten, int state, void *data) if (option_verbose > 1) ast_verbose(VERBOSE_PREFIX_1 "Extension Changed %s new state %s for Notify User %s\n", exten, ast_extension_state2str(state), p->username); + + sip_pvt_unlock(p); + return 0; } |