[asterisk-commits] rmudgett: branch 10 r376869 - in /branches/10: ./ channels/chan_local.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Nov 29 16:58:32 CST 2012
Author: rmudgett
Date: Thu Nov 29 16:58:28 2012
New Revision: 376869
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=376869
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
Modified:
branches/10/ (props changed)
branches/10/channels/chan_local.c
Propchange: branches/10/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.
Modified: branches/10/channels/chan_local.c
URL: http://svnview.digium.com/svn/asterisk/branches/10/channels/chan_local.c?view=diff&rev=376869&r1=376868&r2=376869
==============================================================================
--- branches/10/channels/chan_local.c (original)
+++ branches/10/channels/chan_local.c Thu Nov 29 16:58:28 2012
@@ -307,15 +307,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