]> git.sesse.net Git - ffmpeg/commit
avformat/rmdec: Fix memleaks upon read_header failure
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
Mon, 20 Jul 2020 21:26:15 +0000 (23:26 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
Thu, 8 Apr 2021 09:05:16 +0000 (11:05 +0200)
commit9a471c5437d34cd1e63520b47f50a0fa605a5688
tree70ed5be629cc7644207534f8cd3cd0e0f7e28d53
parentf6ea2ee005740247a446d28174943b3606721967
avformat/rmdec: Fix memleaks upon read_header failure

For both the RealMedia as well as the IVR demuxer (which share the same
context) each AVStream's priv_data contains an AVPacket that might
contain data (even when reading the header) and therefore needs to be
unreferenced. Up until now, this has not always been done:

The RealMedia demuxer didn't do it when allocating a new stream's
priv_data failed although there might be other streams with packets to
unreference. (The reason for this was that until recently rm_read_close()
couldn't handle an AVStream without priv_data, so one had to choose
between a potential crash and a memleak.)

The IVR demuxer meanwhile never ever called read_close so that the data
already contained in packets leaks upon error.

This patch fixes both demuxers by adding the appropriate cleanup code.

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