[FFmpeg-cvslog] avformat/utils: unref packet on AVInputFormat.read_packet() failure

James Almer git at videolan.org
Thu Sep 26 02:53:52 EEST 2019


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Fri Sep 20 22:39:09 2019 +0200| [bae8844e35147f92e612a9e0b44e939a293e5bc9] | committer: James Almer

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 at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bae8844e35147f92e612a9e0b44e939a293e5bc9
---

 libavformat/utils.c | 2 ++
 1 file changed, 2 insertions(+)

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



More information about the ffmpeg-cvslog mailing list