From 467eece1bea5c8325c6974190ba61f1bba88a3f3 Mon Sep 17 00:00:00 2001 From: Andreas Cadhalpun Date: Tue, 8 Nov 2016 23:53:52 +0100 Subject: icodec: fix leaking pkt on error Reviewed-by: Michael Niedermayer Signed-off-by: Andreas Cadhalpun --- libavformat/icodec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'libavformat') diff --git a/libavformat/icodec.c b/libavformat/icodec.c index 8019a35f44..fa985fb313 100644 --- a/libavformat/icodec.c +++ b/libavformat/icodec.c @@ -174,8 +174,10 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) bytestream_put_le16(&buf, 0); bytestream_put_le32(&buf, 0); - if ((ret = avio_read(pb, buf, image->size)) < 0) + if ((ret = avio_read(pb, buf, image->size)) < 0) { + av_packet_unref(pkt); return ret; + } st->codecpar->bits_per_coded_sample = AV_RL16(buf + 14); -- cgit v1.2.3