[svn-commits] tilghman: trunk r182211 - in /trunk: ./ channels/chan_local.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Mar 16 10:50:59 CDT 2009


Author: tilghman
Date: Mon Mar 16 10:50:55 2009
New Revision: 182211

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=182211
Log:
Merged revisions 182208 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r182208 | tilghman | 2009-03-16 10:39:15 -0500 (Mon, 16 Mar 2009) | 7 lines
  
  Fixup glare detection, to fix a memory leak of a local pvt structure.
  (closes issue #14656)
   Reported by: caspy
   Patches: 
         20090313__bug14656__2.diff.txt uploaded by tilghman (license 14)
   Tested by: caspy
........

Modified:
    trunk/   (props changed)
    trunk/channels/chan_local.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/channels/chan_local.c
URL: http://svn.digium.com/svn-view/asterisk/trunk/channels/chan_local.c?view=diff&rev=182211&r1=182210&r2=182211
==============================================================================
--- trunk/channels/chan_local.c (original)
+++ trunk/channels/chan_local.c Mon Mar 16 10:50:55 2009
@@ -203,23 +203,17 @@
 	/* Recalculate outbound channel */
 	other = isoutbound ? p->owner : p->chan;
 
+	if (!other) {
+		return 0;
+	}
+
+	/* do not queue frame if generator is on both local channels */
+	if (us && us->generator && other->generator) {
+		return 0;
+	}
+
 	/* Set glare detection */
 	ast_set_flag(p, LOCAL_GLARE_DETECT);
-	if (ast_test_flag(p, LOCAL_CANCEL_QUEUE)) {
-		/* We had a glare on the hangup.  Forget all this business,
-		return and destroy p.  */
-		ast_mutex_unlock(&p->lock);
-		p = local_pvt_destroy(p);
-		return -1;
-	}
-	if (!other) {
-		ast_clear_flag(p, LOCAL_GLARE_DETECT);
-		return 0;
-	}
-
-	/* do not queue frame if generator is on both local channels */
-	if (us && us->generator && other->generator)
-		return 0;
 
 	/* Ensure that we have both channels locked */
 	while (other && ast_channel_trylock(other)) {
@@ -233,6 +227,17 @@
 			ast_mutex_lock(&p->lock);
 		}
 		other = isoutbound ? p->owner : p->chan;
+	}
+
+	/* Since glare detection only occurs within this function, and because
+	 * a pvt flag cannot be set without having the pvt lock, this is the only
+	 * location where we could detect a cancelling of the queue. */
+	if (ast_test_flag(p, LOCAL_CANCEL_QUEUE)) {
+		/* We had a glare on the hangup.  Forget all this business,
+		return and destroy p.  */
+		ast_mutex_unlock(&p->lock);
+		p = local_pvt_destroy(p);
+		return -1;
 	}
 
 	if (other) {




More information about the svn-commits mailing list