[FFmpeg-cvslog] icodec: fix leaking pkt on error

Andreas Cadhalpun git at videolan.org
Sun Nov 27 01:30:09 EET 2016


ffmpeg | branch: release/3.1 | Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com> | Tue Nov  8 23:53:52 2016 +0100| [356e035773aa2208b985521991de125dc49cf603] | committer: Andreas Cadhalpun

icodec: fix leaking pkt on error

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

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

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

diff --git a/libavformat/icodec.c b/libavformat/icodec.c
index 8019a35..fa985fb 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);
 



More information about the ffmpeg-cvslog mailing list