[FFmpeg-cvslog] matroskadec: check return values

Vittorio Giovara git at videolan.org
Sat Oct 25 04:43:31 CEST 2014


ffmpeg | branch: master | Vittorio Giovara <vittorio.giovara at gmail.com> | Fri Oct 24 00:05:53 2014 +0100| [e0caa1eb4e518111a81801db0d2ccdd2733ba94b] | committer: Vittorio Giovara

matroskadec: check return values

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

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

 libavformat/matroskadec.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index d3ce009..a83589a 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -2132,8 +2132,16 @@ static int matroska_parse_rm_audio(MatroskaDemuxContext *matroska,
     }
 
     while (track->audio.pkt_cnt) {
+        int ret;
         AVPacket *pkt = av_mallocz(sizeof(AVPacket));
-        av_new_packet(pkt, a);
+        if (!pkt)
+            return AVERROR(ENOMEM);
+
+        ret = av_new_packet(pkt, a);
+        if (ret < 0) {
+            av_free(pkt);
+            return ret;
+        }
         memcpy(pkt->data,
                track->audio.buf + a * (h * w / a - track->audio.pkt_cnt--),
                a);



More information about the ffmpeg-cvslog mailing list