[FFmpeg-cvslog] avformat/nsvdec: Check the return value of av_get_packet()

Michael Niedermayer git at videolan.org
Sun Jan 18 21:07:15 CET 2015


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Jan 18 20:52:25 2015 +0100| [8d7ce5cdb707d4b22749f72d3f118e62e2b95cd3] | committer: Michael Niedermayer

avformat/nsvdec: Check the return value of av_get_packet()

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavformat/nsvdec.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c
index f479d1e..f3a26c6 100644
--- a/libavformat/nsvdec.c
+++ b/libavformat/nsvdec.c
@@ -539,6 +539,7 @@ static int nsv_read_chunk(AVFormatContext *s, int fill_header)
     uint32_t vsize;
     uint16_t asize;
     uint16_t auxsize;
+    int ret;
 
     av_dlog(s, "%s(%d)\n", __FUNCTION__, fill_header);
 
@@ -595,7 +596,6 @@ null_chunk_retry:
         st[s->streams[1]->id] = s->streams[1];
 
     if (vsize && st[NSV_ST_VIDEO]) {
-        int ret;
         nst = st[NSV_ST_VIDEO]->priv_data;
         pkt = &nsv->ahead[NSV_ST_VIDEO];
         if ((ret = av_get_packet(pb, pkt, vsize)) < 0)
@@ -641,7 +641,8 @@ null_chunk_retry:
                 av_dlog(s, "NSV RAWAUDIO: bps %d, nchan %d, srate %d\n", bps, channels, samplerate);
             }
         }
-        av_get_packet(pb, pkt, asize);
+        if ((ret = av_get_packet(pb, pkt, asize)) < 0)
+            return ret;
         pkt->stream_index = st[NSV_ST_AUDIO]->index;//NSV_ST_AUDIO;
         pkt->flags |= nsv->state == NSV_HAS_READ_NSVS ? AV_PKT_FLAG_KEY : 0; /* keyframe only likely on a sync frame */
         if( nsv->state == NSV_HAS_READ_NSVS && st[NSV_ST_VIDEO] ) {



More information about the ffmpeg-cvslog mailing list