diff options
author | Matt Jordan <mjordan@digium.com> | 2015-09-27 20:45:50 -0500 |
---|---|---|
committer | Matt Jordan <mjordan@digium.com> | 2015-09-27 20:45:50 -0500 |
commit | 9402f80726c2191c939aa75af1c8360409e5d2ef (patch) | |
tree | 88093ca0e6ff821f55a68629a1097d0fcb8a394c /res/res_stasis.c | |
parent | 6392fdf6dc3805fc08834ec0061601d880729ed1 (diff) |
res/res_stasis: Fix accidental subscription to 'all' bridge topic
When b99a7052621700a1aa641a1c24308f5873275fc8 was merged, subscribing to a
NULL bridge will now cause app_subscribe_bridge to implicitly subscribe to
all bridges. Unfortunately, the res_stasis control loop did not check that
a bridge changing on a channel's control object was actually also non-NULL.
As a result, app_subscribe_bridge will be called with a NULL bridge when a
channel leaves a bridge. This causes a new subscription to be made to the
bridge. If an application has also subscribed to the bridge, the application
will now have two subscriptions:
(1) The explicit one created by the app
(2) The implicit one accidentally created by the control structure
As a result, the 'BridgeDestroyed' event can be sent multiple times. This
patch corrects the control loop such that it only subscribes an application
to a new bridge if the bridge pointer is non-NULL.
ASTERISK-24870
Change-Id: I3510e55f6bc36517c10597ead857b964463c9f4f
Diffstat (limited to 'res/res_stasis.c')
-rw-r--r-- | res/res_stasis.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/res/res_stasis.c b/res/res_stasis.c index 69e9b935d..abca895ee 100644 --- a/res/res_stasis.c +++ b/res/res_stasis.c @@ -1294,7 +1294,9 @@ int stasis_app_exec(struct ast_channel *chan, const char *app_name, int argc, if (bridge != last_bridge) { app_unsubscribe_bridge(app, last_bridge); - app_subscribe_bridge(app, bridge); + if (bridge) { + app_subscribe_bridge(app, bridge); + } } if (bridge) { |