]> 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)
committerGeorge Joseph <gjoseph@sangoma.com>
Tue, 11 Feb 2025 23:31:16 +0000 (23:31 +0000)
commit1a1eb8821185c0f4945d6ca0654ea6763e1560fb
tree720fdfd5c1ee624cf21ed6b06fdea0aad7e3e8c9
parenta0d0c47d064206b61b958a016322dd3b1144ed3c
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