]> 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)
commit5267c176452e26af81a208e076e2150df1a8537c
tree365071d5a690a094256b449d190b847b10c929ba
parent71eb8a262f53f0a417991232ecff0eb67a3bca6a
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