diff options
author | Kinsey Moore <kmoore@digium.com> | 2014-04-07 14:29:37 +0000 |
---|---|---|
committer | Kinsey Moore <kmoore@digium.com> | 2014-04-07 14:29:37 +0000 |
commit | 62e2bf68f0ccf3c9276d8a8581482e98373e788b (patch) | |
tree | 79bc883fa14973ce3c804383e3533ced250a35d2 /res/res_stasis.c | |
parent | 5d9a1281eebe29bd6b0a370514be6a29dac5af28 (diff) |
Stasis: Fix Stasis() bridge refcount issue
The Stasis() dialplan application monitors what bridge a channel is in
and so necessarily holds on to a bridge pointer. This change ensures
that it also holds on to a reference for that bridge to prevent the
bridge pointer from becoming a dangling pointer.
........
Merged revisions 411804 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@411806 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_stasis.c')
-rw-r--r-- | res/res_stasis.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/res/res_stasis.c b/res/res_stasis.c index 251c74420..32ac7b686 100644 --- a/res/res_stasis.c +++ b/res/res_stasis.c @@ -777,7 +777,7 @@ int stasis_app_exec(struct ast_channel *chan, const char *app_name, int argc, RAII_VAR(struct ast_frame *, f, NULL, ast_frame_dtor); int r; int command_count; - struct ast_bridge *last_bridge; + RAII_VAR(struct ast_bridge *, last_bridge, NULL, ao2_cleanup); /* Check to see if a bridge absorbed our hangup frame */ if (ast_check_hangup_locked(chan)) { @@ -785,7 +785,7 @@ int stasis_app_exec(struct ast_channel *chan, const char *app_name, int argc, } last_bridge = bridge; - bridge = stasis_app_get_bridge(control); + bridge = ao2_bump(stasis_app_get_bridge(control)); if (bridge != last_bridge) { app_unsubscribe_bridge(app, last_bridge); @@ -839,6 +839,7 @@ int stasis_app_exec(struct ast_channel *chan, const char *app_name, int argc, app_unsubscribe_bridge(app, stasis_app_get_bridge(control)); app_unsubscribe_channel(app, chan); + ao2_cleanup(bridge); res = send_end_msg(app, chan); if (res != 0) { |