summaryrefslogtreecommitdiff
path: root/libavformat/yuv4mpegdec.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavformat/yuv4mpegdec.c')
-rw-r--r--libavformat/yuv4mpegdec.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavformat/yuv4mpegdec.c b/libavformat/yuv4mpegdec.c
index a91645f6d6..462b823860 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;