Fix a simple deadlock that was introduced _right_ before this code got merged
authorRussell Bryant <russell@russellbryant.com>
Thu, 31 Jan 2008 21:33:33 +0000 (21:33 +0000)
committerRussell Bryant <russell@russellbryant.com>
Thu, 31 Jan 2008 21:33:33 +0000 (21:33 +0000)
into trunk.

(closes issue #11895, reported by pj, patched by me)

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

channels/chan_sip.c

index 041ddaa..ee9fb33 100644 (file)
@@ -17903,8 +17903,10 @@ static struct server_instance *sip_tcp_locate(struct sockaddr_in *s)
        AST_LIST_TRAVERSE(&threadl, th, list) {
                if ((s->sin_family == th->ser->requestor.sin_family) &&
                        (s->sin_addr.s_addr == th->ser->requestor.sin_addr.s_addr) &&
-                       (s->sin_port == th->ser->requestor.sin_port)) 
+                       (s->sin_port == th->ser->requestor.sin_port))  {
+                               AST_LIST_UNLOCK(&threadl);
                                return th->ser;
+                       }
        }
        AST_LIST_UNLOCK(&threadl);
        return NULL;