[Asterisk-code-review] res stasis: Fix dial bridge unload. (asterisk[15])

Corey Farrell asteriskteam at digium.com
Sun Jan 7 22:01:26 CST 2018


Corey Farrell has uploaded this change for review. ( https://gerrit.asterisk.org/7869


Change subject: res_stasis: Fix dial bridge unload.
......................................................................

res_stasis: Fix dial bridge unload.

If the dial bridge has been created it must be released by calling
ast_bridge_destroy, simply releasing the ao2 reference is not enough.

Also move stasis_app_control_shutdown earlier in unload to ensure the
bridge cannot be created or grabbed after the app_bridges container is
released.

Change-Id: I372302de94ca63876069e2585a049c5060e5e767
---
M res/res_stasis.c
M res/stasis/control.c
2 files changed, 7 insertions(+), 4 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/69/7869/1

diff --git a/res/res_stasis.c b/res/res_stasis.c
index 42a19bf..1f5296d 100644
--- a/res/res_stasis.c
+++ b/res/res_stasis.c
@@ -1992,6 +1992,9 @@
 	messaging_cleanup();
 
 	cleanup();
+
+	stasis_app_control_shutdown();
+
 	ao2_cleanup(apps_registry);
 	apps_registry = NULL;
 
@@ -2006,8 +2009,6 @@
 
 	ao2_cleanup(app_bridges_playback);
 	app_bridges_playback = NULL;
-
-	stasis_app_control_shutdown();
 
 	STASIS_MESSAGE_TYPE_CLEANUP(end_message_type);
 	STASIS_MESSAGE_TYPE_CLEANUP(start_message_type);
diff --git a/res/stasis/control.c b/res/stasis/control.c
index 314d68a..8199e46 100644
--- a/res/stasis/control.c
+++ b/res/stasis/control.c
@@ -1507,7 +1507,9 @@
 {
 	ast_mutex_lock(&dial_bridge_lock);
 	shutting_down = 1;
-	ao2_cleanup(dial_bridge);
-	dial_bridge = NULL;
+	if (dial_bridge) {
+		ast_bridge_destroy(dial_bridge, 0);
+		dial_bridge = NULL;
+	}
 	ast_mutex_unlock(&dial_bridge_lock);
 }

-- 
To view, visit https://gerrit.asterisk.org/7869
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 15
Gerrit-MessageType: newchange
Gerrit-Change-Id: I372302de94ca63876069e2585a049c5060e5e767
Gerrit-Change-Number: 7869
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180107/fe65cbb6/attachment-0001.html>


More information about the asterisk-code-review mailing list