ffmpeg | branch: release/2.8 | Andreas Cadhalpun 
<andreas.cadhal...@googlemail.com> | Tue Nov  8 23:53:52 2016 +0100| 
[8a56b31e7cd1af1e3de59bfe3e79d5d7171404d4] | committer: Andreas Cadhalpun

icodec: fix leaking pkt on error

Reviewed-by: Michael Niedermayer <mich...@niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <andreas.cadhal...@googlemail.com>
(cherry picked from commit 467eece1bea5c8325c6974190ba61f1bba88a3f3)
Signed-off-by: Andreas Cadhalpun <andreas.cadhal...@googlemail.com>

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

 libavformat/icodec.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/icodec.c b/libavformat/icodec.c
index 847f0ee..99f5878 100644
--- a/libavformat/icodec.c
+++ b/libavformat/icodec.c
@@ -148,8 +148,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->codec->bits_per_coded_sample = AV_RL16(buf + 14);
 

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

Reply via email to