avformat/avidec: Fix memleak with embedded GAB2 subtitles
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Fri, 27 Mar 2020 07:31:29 +0000 (08:31 +0100)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Sun, 5 Apr 2020 16:38:26 +0000 (18:38 +0200)
commitda44bbefaabeb2fdb58a03fe533a44aa150486fc
tree42cab3bfc781d570f3f691ded20a9dc6dedd60d8
parentde0b04551da4e1470ce1c99321a768887df8c650
avformat/avidec: Fix memleak with embedded GAB2 subtitles

The code for GAB2 subtitles predates refcounting AVPackets. So in order
to transfer the ownership of a packet's data pkt->data was simply stored
and the packet zeroed; in the end (i.e. in the read_close-function) this
data was then simply freed with av_freep(). This of course leads to a leak
of an AVBufferRef and an AVBuffer. It has been fixed by keeping and
eventually unreferencing the packet's buf instead.

Additionally, the packet is now reset via av_packet_unref().

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