[asterisk-commits] mmichelson: branch 1.8 r369708 - /branches/1.8/main/bridging.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jul 6 10:20:16 CDT 2012


Author: mmichelson
Date: Fri Jul  6 10:20:11 2012
New Revision: 369708

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=369708
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


Modified:
    branches/1.8/main/bridging.c

Modified: branches/1.8/main/bridging.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/bridging.c?view=diff&rev=369708&r1=369707&r2=369708
==============================================================================
--- branches/1.8/main/bridging.c (original)
+++ branches/1.8/main/bridging.c Fri Jul  6 10:20:11 2012
@@ -235,9 +235,6 @@
 		}
 	}
 
-	/* Since all the channels are going away let's go ahead and stop our on thread */
-	bridge->stop = 1;
-
 	return;
 }
 
@@ -521,9 +518,14 @@
 
 	ao2_lock(bridge);
 
-	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 asterisk-commits mailing list