]> git.sesse.net Git - ffmpeg/commit
avformat/flacenc: Fix memleak when writing attached pictures fails
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Fri, 20 Nov 2020 16:36:39 +0000 (17:36 +0100)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Thu, 26 Nov 2020 12:32:30 +0000 (13:32 +0100)
commit029cf6a91ceb849f31f575111070a113c53b29ee
treeadb689c745662c0bb6e525446b79fd41840b4d45
parentf7d7ce4717a1331b17d3b09d4ad92feeb1f4b5a3
avformat/flacenc: Fix memleak when writing attached pictures fails

The FLAC muxer currently stores an attached picture corresponding to an
AVStream in AVStream.priv_data. The AVPacket contained therein is
unreferenced after it has been written. The AVPacket structure itself is
then freed generically as AVStream.priv_data.

And this can lead to memleaks if an attached picture is not written:
It might be because the trailer is never written or because writing
a previous attached picture failed in case error_recognition is set
to explode.

Therefore free the packets properly (i.e. with av_packet_free())
in the muxer's deinit function.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavformat/flacenc.c