diff options
author | Matthew Jordan <mjordan@digium.com> | 2013-06-12 02:13:31 +0000 |
---|---|---|
committer | Matthew Jordan <mjordan@digium.com> | 2013-06-12 02:13:31 +0000 |
commit | 41e428275101c117607f9a6503f054f13fa8f78b (patch) | |
tree | b6513eb05110098cfe5f5e4f6d9a1bf36a523729 /main/stasis_channels.c | |
parent | 0e2832d121e97b96093daefe9176f88ba0b9507c (diff) |
Fix memory leaks in stasis_channels and bridge_native_rtp
This patch fixes two memory leaks:
* A memory leak in packing channels into a multi-channel blob payload when
publishing dial messages. The multi-channel blob payload does not steal
the references - this approach was chosen because it works well with the
RAII_VAR macro. Unfortunately, this does mean that you actually have to use
the RAII_VAR macro (or manually deref it yourself)
* RTP instances returned as a result of one of the glue operations are ref
counted and have to be de-ref'd appropriately. We now do that, as saying
that we should do it and then not would be silly.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391479 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/stasis_channels.c')
-rw-r--r-- | main/stasis_channels.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/main/stasis_channels.c b/main/stasis_channels.c index 8327384d7..badcca243 100644 --- a/main/stasis_channels.c +++ b/main/stasis_channels.c @@ -120,6 +120,7 @@ static void channel_snapshot_dtor(void *obj) { struct ast_channel_snapshot *snapshot = obj; ast_string_field_free_memory(snapshot); + ao2_cleanup(snapshot->manager_vars); } struct ast_channel_snapshot *ast_channel_snapshot_create(struct ast_channel *chan) @@ -199,8 +200,8 @@ void ast_channel_publish_dial(struct ast_channel *caller, struct ast_channel *pe RAII_VAR(struct ast_multi_channel_blob *, payload, NULL, ao2_cleanup); RAII_VAR(struct stasis_message *, msg, NULL, ao2_cleanup); RAII_VAR(struct ast_json *, blob, NULL, ast_json_unref); - struct ast_channel_snapshot *caller_snapshot; - struct ast_channel_snapshot *peer_snapshot; + RAII_VAR(struct ast_channel_snapshot *, caller_snapshot, NULL, ao2_cleanup); + RAII_VAR(struct ast_channel_snapshot *, peer_snapshot, NULL, ao2_cleanup); ast_assert(peer != NULL); blob = ast_json_pack("{s: s, s: s}", |