]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_stasis: Fix dial bridge unload.
authorCorey Farrell <git@cfware.com>
Mon, 8 Jan 2018 03:38:49 +0000 (22:38 -0500)
committerCorey Farrell <git@cfware.com>
Mon, 8 Jan 2018 04:01:25 +0000 (22:01 -0600)
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

res/res_stasis.c
res/stasis/control.c

index 42a19bf5607a11600e9f0b0e85f5d6f904db3c1e..1f5296d8ed4ab9c37980f73891921b6469cc481f 100644 (file)
@@ -1992,6 +1992,9 @@ static int unload_module(void)
        messaging_cleanup();
 
        cleanup();
+
+       stasis_app_control_shutdown();
+
        ao2_cleanup(apps_registry);
        apps_registry = NULL;
 
@@ -2007,8 +2010,6 @@ static int unload_module(void)
        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);
 
index 314d68a0878d664a29d3bb8f9b8ffc4723a8b1d4..8199e46b24629e32a967a5128c780ce10f3426c8 100644 (file)
@@ -1507,7 +1507,9 @@ void stasis_app_control_shutdown(void)
 {
        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);
 }