diff options
author | Mark Michelson <mmichelson@digium.com> | 2012-07-06 15:31:52 +0000 |
---|---|---|
committer | Mark Michelson <mmichelson@digium.com> | 2012-07-06 15:31:52 +0000 |
commit | 8e7ad68b1af6dd022f2d73ce8ecc6268a9e1b140 (patch) | |
tree | 8a75655bd57f0e5ccc73e90009391437d07cfc77 /main/bridging.c | |
parent | 96a4b257bd10ab5aaa6f25a0716a0f521a2bf5a0 (diff) |
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
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@369710 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/bridging.c')
-rw-r--r-- | main/bridging.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/main/bridging.c b/main/bridging.c index 8bb13f916..465d0339f 100644 --- a/main/bridging.c +++ b/main/bridging.c @@ -234,9 +234,6 @@ static void bridge_check_dissolve(struct ast_bridge *bridge, struct ast_bridge_c } } - /* Since all the channels are going away let's go ahead and stop our on thread */ - bridge->stop = 1; - return; } @@ -544,9 +541,14 @@ int ast_bridge_destroy(struct ast_bridge *bridge) 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); |