[FFmpeg-cvslog] img2dec: check av_new_packet return value

Vittorio Giovara git at videolan.org
Sat Oct 25 03:44:13 CEST 2014


ffmpeg | branch: master | Vittorio Giovara <vittorio.giovara at gmail.com> | Mon Oct 20 14:11:15 2014 +0100| [f1ed83e23add1c26c50b146727e4c2399dfc0b3a] | committer: Vittorio Giovara

img2dec: check av_new_packet return value

CC: libav-stable at libav.org
Bug-Id: CID 1087077

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

 libavformat/img2dec.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
index 9acb6f6..f7f0a11 100644
--- a/libavformat/img2dec.c
+++ b/libavformat/img2dec.c
@@ -221,7 +221,7 @@ static int img_read_packet(AVFormatContext *s1, AVPacket *pkt)
 {
     VideoDemuxData *s = s1->priv_data;
     char filename[1024];
-    int i;
+    int i, res;
     int size[3]           = { 0 }, ret[3] = { 0 };
     AVIOContext *f[3]     = { NULL };
     AVCodecContext *codec = s1->streams[0]->codec;
@@ -262,7 +262,9 @@ static int img_read_packet(AVFormatContext *s1, AVPacket *pkt)
         size[0] = 4096;
     }
 
-    av_new_packet(pkt, size[0] + size[1] + size[2]);
+    res = av_new_packet(pkt, size[0] + size[1] + size[2]);
+    if (res < 0)
+        return res;
     pkt->stream_index = 0;
     pkt->flags       |= AV_PKT_FLAG_KEY;
 



More information about the ffmpeg-cvslog mailing list