diff options
author | Richard Mudgett <rmudgett@digium.com> | 2014-04-15 18:30:24 +0000 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2014-04-15 18:30:24 +0000 |
commit | ba1db5d8f536807415068810832ab2daed56f3bb (patch) | |
tree | 1e85d198b6973bb7d1e52fd72e9408ba0a95f320 /main/stasis_channels.c | |
parent | 45ade68cb48baad5f4f994fae6fe52211f379f70 (diff) |
Eliminate some more unnecessary RAII_VAR() uses.
RAII_VAR() is not a hammer appropriate to pound all nails.
........
Merged revisions 412413 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@412414 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/stasis_channels.c')
-rw-r--r-- | main/stasis_channels.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/main/stasis_channels.c b/main/stasis_channels.c index c75d17492..eefb7a9f8 100644 --- a/main/stasis_channels.c +++ b/main/stasis_channels.c @@ -172,8 +172,8 @@ static void channel_snapshot_dtor(void *obj) struct ast_channel_snapshot *ast_channel_snapshot_create(struct ast_channel *chan) { - RAII_VAR(struct ast_channel_snapshot *, snapshot, NULL, ao2_cleanup); - RAII_VAR(struct ast_bridge *, bridge, NULL, ao2_cleanup); + struct ast_channel_snapshot *snapshot; + struct ast_bridge *bridge; char nativeformats[256]; struct ast_str *write_transpath = ast_str_alloca(256); struct ast_str *read_transpath = ast_str_alloca(256); @@ -187,6 +187,7 @@ struct ast_channel_snapshot *ast_channel_snapshot_create(struct ast_channel *cha snapshot = ao2_alloc(sizeof(*snapshot), channel_snapshot_dtor); if (!snapshot || ast_string_field_init(snapshot, 1024)) { + ao2_cleanup(snapshot); return NULL; } @@ -231,6 +232,7 @@ struct ast_channel_snapshot *ast_channel_snapshot_create(struct ast_channel *cha if ((bridge = ast_channel_get_bridge(chan))) { ast_string_field_set(snapshot, bridgeid, bridge->uniqueid); + ao2_cleanup(bridge); } ast_string_field_set(snapshot, nativeformats, ast_getformatname_multiple(nativeformats, sizeof(nativeformats), @@ -267,7 +269,6 @@ struct ast_channel_snapshot *ast_channel_snapshot_create(struct ast_channel *cha snapshot->channel_vars = ast_channel_get_vars(chan); snapshot->tech_properties = ast_channel_tech(chan)->properties; - ao2_ref(snapshot, +1); return snapshot; } |