]> git.ipfire.org Git - thirdparty/asterisk.git/commit
resource_channels.c: Fix memory leak in ast_ari_channels_external_media.
authorGeorge Joseph <gjoseph@sangoma.com>
Tue, 4 Feb 2025 20:00:16 +0000 (13:00 -0700)
committergithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Tue, 11 Feb 2025 23:31:21 +0000 (23:31 +0000)
commit3e74da3224cb91df9e9adde96b864fef84a595ea
tree1b863879aaff6172f76a81eb54610fe763c81b9a
parent9fc631d028b65c40ce5f0e6d8b43b37bcf999207
resource_channels.c: Fix memory leak in ast_ari_channels_external_media.

Between ast_ari_channels_external_media(), external_media_rtp_udp(),
and external_media_audiosocket_tcp(), the `variables` structure being passed
around wasn't being cleaned up properly when there was a failure.

* In ast_ari_channels_external_media(), the `variables` structure is now
  defined with RAII_VAR to ensure it always gets cleaned up.

* The ast_variables_destroy() call was removed from external_media_rtp_udp().

* The ast_variables_destroy() call was removed from
  external_media_audiosocket_tcp(), its `endpoint` allocation was changed to
  to use ast_asprintf() as external_media_rtp_udp() does, and it now
  returns an error on failure.

* ast_ari_channels_external_media() now checks the new return code from
  external_media_audiosocket_tcp() and sets the appropriate error response.

Resolves: #1109
res/ari/resource_channels.c