Fix memory leaks in stasis_channels and bridge_native_rtp
[asterisk/asterisk.git] / main / stasis_channels.c
index 8327384..badcca2 100644 (file)
@@ -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}",