]> git.ipfire.org Git - thirdparty/asterisk.git/commit
streams: Fix one memory leak and one formats ref issue
authorGeorge Joseph <gjoseph@digium.com>
Mon, 4 May 2020 16:31:57 +0000 (10:31 -0600)
committerFriendly Automation <jenkins2@gerrit.asterisk.org>
Wed, 6 May 2020 12:27:49 +0000 (07:27 -0500)
commitb43b04a1f48f791c90dd52836e037501d706dd87
treec57f9337befeefe6164147e9fa10255699313f19
parent1e16c84be027d0aa2bc11a0714c6928706728f35
streams: Fix one memory leak and one formats ref issue

ast_stream_topology_create_from_format_cap() was setting the
stream->formats directly but not freeing the default formats.  This
causes a memory leak.

* ast_stream_topology_create_from_format_cap() now calls
  ast_stream_set_formats() which properly cleans up the existing
  stream formats.

When cloning a stream, the source stream's format caps _pointer_ is
copied to the new stream and it's reference count bumped.  If
either stream is set to "removed", this will cause _both_ streams
to have their format caps cleared.

* ast_stream_clone() now creates a new format caps object and copies
  the formats from the source stream instead of just copying the
  pointer.

ASTERISK-28870

Change-Id: If697d81c3658eb7baeea6dab413b13423938fb53
main/stream.c