Browse Source

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>
tags/n4.3
James Almer 5 years ago
parent
commit
bae8844e35
1 changed files with 2 additions and 0 deletions
  1. +2
    -0
      libavformat/utils.c

+ 2
- 0
libavformat/utils.c View File

@@ -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. */


Loading…
Cancel
Save