]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fix a bug in chan_local glare hangup detection.
authorJoshua Colp <jcolp@digium.com>
Thu, 23 Apr 2009 19:13:18 +0000 (19:13 +0000)
committerJoshua Colp <jcolp@digium.com>
Thu, 23 Apr 2009 19:13:18 +0000 (19:13 +0000)
If both sides of a Local channel were hung up at around the same time it was
possible for one thread to destroy the local private structure and have the other thread
immediately try to remove the already freed structure from the local channel list.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@190286 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_local.c

index db8bec313b59ff77cef725e06f3b8f550686dc3e..aa81af51c18f004b0aef2ec5539963684db1383d 100644 (file)
@@ -590,13 +590,10 @@ static int local_hangup(struct ast_channel *ast)
                   let local_queue do it. */
                if (glaredetect)
                        ast_set_flag(p, LOCAL_CANCEL_QUEUE);
-               ast_mutex_unlock(&p->lock);
                /* Remove from list */
                AST_LIST_LOCK(&locals);
                AST_LIST_REMOVE(&locals, p, list);
                AST_LIST_UNLOCK(&locals);
-               /* Grab / release lock just in case */
-               ast_mutex_lock(&p->lock);
                ast_mutex_unlock(&p->lock);
                /* And destroy */
                if (!glaredetect) {