Merged revisions 376867,376871 via svnmerge from
authorAutomerge script <automerge@asterisk.org>
Thu, 29 Nov 2012 23:19:44 +0000 (23:19 +0000)
committerAutomerge script <automerge@asterisk.org>
Thu, 29 Nov 2012 23:19:44 +0000 (23:19 +0000)
file:///srv/subversion/repos/asterisk/trunk

................
  r376867 | rmudgett | 2012-11-29 16:34:24 -0600 (Thu, 29 Nov 2012) | 13 lines

  Fix compile error.

  (issue ASTERISK-20724)
  ........

  Merged revisions 376864 from http://svn.asterisk.org/svn/asterisk/branches/1.8
  ........

  Merged revisions 376865 from http://svn.asterisk.org/svn/asterisk/branches/10
  ........

  Merged revisions 376866 from http://svn.asterisk.org/svn/asterisk/branches/11
................
  r376871 | rmudgett | 2012-11-29 17:01:16 -0600 (Thu, 29 Nov 2012) | 13 lines

  chan_local: Fix local_pvt ref leak in local_devicestate().

  Regression introduced by ASTERISK-20390 fix.
  ........

  Merged revisions 376868 from http://svn.asterisk.org/svn/asterisk/branches/1.8
  ........

  Merged revisions 376869 from http://svn.asterisk.org/svn/asterisk/branches/10
  ........

  Merged revisions 376870 from http://svn.asterisk.org/svn/asterisk/branches/11
................

git-svn-id: https://origsvn.digium.com/svn/asterisk/team/mmichelson/threadpool@376878 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_local.c
channels/chan_sip.c

index 4e03166..da86e14 100644 (file)
@@ -311,15 +311,20 @@ static int local_devicestate(const char *data)
        res = AST_DEVICE_NOT_INUSE;
 
        it = ao2_iterator_init(locals, 0);
        res = AST_DEVICE_NOT_INUSE;
 
        it = ao2_iterator_init(locals, 0);
-       while ((lp = ao2_iterator_next(&it)) && (res == AST_DEVICE_NOT_INUSE)) {
-               if (!strcmp(exten, lp->exten) && !strcmp(context, lp->context) && lp->owner) {
-                       ao2_lock(lp);
-                       if (ast_test_flag(lp, LOCAL_LAUNCHED_PBX)) {
-                               res = AST_DEVICE_INUSE;
-                       }
-                       ao2_unlock(lp);
+       for (; (lp = ao2_iterator_next(&it)); ao2_ref(lp, -1)) {
+               int is_inuse;
+
+               ao2_lock(lp);
+               is_inuse = !strcmp(exten, lp->exten)
+                       && !strcmp(context, lp->context)
+                       && lp->owner
+                       && ast_test_flag(lp, LOCAL_LAUNCHED_PBX);
+               ao2_unlock(lp);
+               if (is_inuse) {
+                       res = AST_DEVICE_INUSE;
+                       ao2_ref(lp, -1);
+                       break;
                }
                }
-               ao2_ref(lp, -1);
        }
        ao2_iterator_destroy(&it);
 
        }
        ao2_iterator_destroy(&it);
 
index 0dc6069..30177d1 100644 (file)
@@ -17897,7 +17897,7 @@ static void check_via(struct sip_pvt *p, struct sip_request *req)
                if (ast_sockaddr_resolve_first(&tmp, c, 0)) {
                        ast_log(LOG_WARNING, "Could not resolve socket address for '%s'\n", c);
                        port = STANDARD_SIP_PORT;
                if (ast_sockaddr_resolve_first(&tmp, c, 0)) {
                        ast_log(LOG_WARNING, "Could not resolve socket address for '%s'\n", c);
                        port = STANDARD_SIP_PORT;
-               } else if (!(port = ast_sockaddr_port(&tmp)) {
+               } else if (!(port = ast_sockaddr_port(&tmp))) {
                        port = STANDARD_SIP_PORT;
                        ast_sockaddr_set_port(&tmp, port);
                }
                        port = STANDARD_SIP_PORT;
                        ast_sockaddr_set_port(&tmp, port);
                }