diff options
author | Richard Mudgett <rmudgett@digium.com> | 2013-06-26 01:46:30 +0000 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2013-06-26 01:46:30 +0000 |
commit | a022379107a6c55d5c8ce393d1f5da6691ccac3c (patch) | |
tree | d5ecd8e834e4963f863415113fc0df56f9c0e228 /apps/confbridge/conf_chan_announce.c | |
parent | f25bbd6c56e55c4dca7239f0c56eb4b6bee1b155 (diff) |
Fix incorrect calls to ast_bridge_impart().
There was a misunderstanding about ast_bridge_impart()'s handling of the
imparted channel's reference. The channel reference is passed by the
caller unless ast_bridge_impart() returns an error.
* Fixed a memory leak in conf_announce_channel_push() if the impart
failed.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@392934 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/confbridge/conf_chan_announce.c')
-rw-r--r-- | apps/confbridge/conf_chan_announce.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/apps/confbridge/conf_chan_announce.c b/apps/confbridge/conf_chan_announce.c index 46e074b20..af9688437 100644 --- a/apps/confbridge/conf_chan_announce.c +++ b/apps/confbridge/conf_chan_announce.c @@ -172,8 +172,8 @@ void conf_announce_channel_depart(struct ast_channel *chan) int conf_announce_channel_push(struct ast_channel *ast) { struct ast_bridge_features *features; + struct ast_channel *chan; RAII_VAR(struct announce_pvt *, p, NULL, ao2_cleanup); - RAII_VAR(struct ast_channel *, chan, NULL, ast_channel_unref); { SCOPED_CHANNELLOCK(lock, ast); @@ -192,12 +192,15 @@ int conf_announce_channel_push(struct ast_channel *ast) features = ast_bridge_features_new(); if (!features) { + ast_channel_unref(chan); return -1; } ast_set_flag(&features->feature_flags, AST_BRIDGE_CHANNEL_FLAG_IMMOVABLE); /* Impart the output channel into the bridge */ if (ast_bridge_impart(p->bridge, chan, NULL, features, 0)) { + ast_bridge_features_destroy(features); + ast_channel_unref(chan); return -1; } ao2_lock(p); |