summaryrefslogtreecommitdiff
path: root/libavformat/utils.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2019-09-20 22:39:09 +0200
committerJames Almer <jamrial@gmail.com>2019-09-25 20:53:05 -0300
commitbae8844e35147f92e612a9e0b44e939a293e5bc9 (patch)
tree9c637c43c6c620ef6ccd66856f871b3f21b41a67 /libavformat/utils.c
parent66d5e43b9909804511a3e1fb65f6f0bbb0264eb3 (diff)
avformat/utils: unref packet on AVInputFormat.read_packet() failure
Demuxers may have allocated a packet before encountering an error and aborting. Fixes ticket #8150 Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r--libavformat/utils.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index a7f2582e0e..4657ba2642 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -854,6 +854,8 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
av_init_packet(pkt);
ret = s->iformat->read_packet(s, pkt);
if (ret < 0) {
+ av_packet_unref(pkt);
+
/* Some demuxers return FFERROR_REDO when they consume
data and discard it (ignored streams, junk, extradata).
We must re-call the demuxer to get the real packet. */