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

Andreas Cadhalpun git at videolan.org
Wed Nov 9 22:17:22 EET 2016


ffmpeg | branch: master | Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com> | Tue Nov  8 23:53:52 2016 +0100| [467eece1bea5c8325c6974190ba61f1bba88a3f3] | 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>

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

 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