[svn-commits] mmichelson: trunk r369710 - in /trunk: ./ main/bridging.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Jul 6 10:32:00 CDT 2012


Author: mmichelson
Date: Fri Jul  6 10:31:52 2012
New Revision: 369710

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=369710
Log:
Fix bridging thread leak.

The bridge thread was exiting but was never being
reaped using pthread_join(). This has been fixed now
by calling pthread_join() in ast_bridge_destroy().

(closes issue ASTERISK-19834)
Reported by Marcus Hunger

Review: https://reviewboard.asterisk.org/r/2012
........

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

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

Modified:
    trunk/   (props changed)
    trunk/main/bridging.c

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

Modified: trunk/main/bridging.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/bridging.c?view=diff&rev=369710&r1=369709&r2=369710
==============================================================================
--- trunk/main/bridging.c (original)
+++ trunk/main/bridging.c Fri Jul  6 10:31:52 2012
@@ -234,9 +234,6 @@
 		}
 	}
 
-	/* Since all the channels are going away let's go ahead and stop our on thread */
-	bridge->stop = 1;
-
 	return;
 }
 
@@ -544,9 +541,14 @@
 		bridge->callid = ast_callid_unref(bridge->callid);
 	}
 
-	bridge->stop = 1;
-
-	bridge_poke(bridge);
+	if (bridge->thread != AST_PTHREADT_NULL) {
+		pthread_t thread = bridge->thread;
+		bridge->stop = 1;
+		bridge_poke(bridge);
+		ao2_unlock(bridge);
+		pthread_join(thread, NULL);
+		ao2_lock(bridge);
+	}
 
 	ast_debug(1, "Telling all channels in bridge %p to end and leave the party\n", bridge);
 




More information about the svn-commits mailing list