[asterisk-commits] rmudgett: branch 11 r376870 - in /branches/11: ./ channels/chan_local.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Nov 29 16:59:53 CST 2012
Author: rmudgett
Date: Thu Nov 29 16:59:50 2012
New Revision: 376870
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=376870
Log:
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
Modified:
branches/11/ (props changed)
branches/11/channels/chan_local.c
Propchange: branches/11/
------------------------------------------------------------------------------
Binary property 'branch-10-merged' - no diff available.
Modified: branches/11/channels/chan_local.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/channels/chan_local.c?view=diff&rev=376870&r1=376869&r2=376870
==============================================================================
--- branches/11/channels/chan_local.c (original)
+++ branches/11/channels/chan_local.c Thu Nov 29 16:59:50 2012
@@ -311,15 +311,20 @@
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);
- }
- ao2_ref(lp, -1);
+ 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_iterator_destroy(&it);
More information about the asterisk-commits
mailing list