[FFmpeg-cvslog] yuv4mpegdec: fix leaking pkt in yuv4_read_packet

Andreas Cadhalpun git at videolan.org
Thu Dec 8 01:28:01 EET 2016


ffmpeg | branch: master | Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com> | Mon Dec  5 22:56:36 2016 +0100| [e3694478a98bc2cd702b3b3f0bfb19a100da737e] | committer: Andreas Cadhalpun

yuv4mpegdec: fix leaking pkt in yuv4_read_packet

Reviewed-by: Michael Niedermayer <michael at niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>

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

 libavformat/yuv4mpegdec.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavformat/yuv4mpegdec.c b/libavformat/yuv4mpegdec.c
index a91645f..462b823 100644
--- a/libavformat/yuv4mpegdec.c
+++ b/libavformat/yuv4mpegdec.c
@@ -295,9 +295,10 @@ static int yuv4_read_packet(AVFormatContext *s, AVPacket *pkt)
     ret = av_get_packet(s->pb, pkt, s->packet_size - Y4M_FRAME_MAGIC_LEN);
     if (ret < 0)
         return ret;
-    else if (ret != s->packet_size - Y4M_FRAME_MAGIC_LEN)
+    else if (ret != s->packet_size - Y4M_FRAME_MAGIC_LEN) {
+        av_packet_unref(pkt);
         return s->pb->eof_reached ? AVERROR_EOF : AVERROR(EIO);
-
+    }
     pkt->stream_index = 0;
     pkt->pts = (off - s->internal->data_offset) / s->packet_size;
     pkt->duration = 1;



More information about the ffmpeg-cvslog mailing list