]> 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)
commit873c247f751b83da096abd48b5162c1a9a914554
treed2de0dac50e60815c1378139f59d07b83cf083e5
parent5e4fca062c9f4b4f0aaf5ce9572ae5a3379d6b25
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