avformat/utils: check for malloc failure
authorwm4 <nfxjfg@googlemail.com>
Fri, 12 Dec 2014 21:22:55 +0000 (22:22 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 12 Dec 2014 22:37:29 +0000 (23:37 +0100)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/utils.c

index 5a2a72d..8aee511 100644 (file)
@@ -3652,6 +3652,11 @@ AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c)
     st->info->last_dts = AV_NOPTS_VALUE;
 
     st->codec = avcodec_alloc_context3(c);
+    if (!st->codec) {
+        av_free(st->info);
+        av_free(st);
+        return NULL;
+    }
     if (s->iformat) {
         /* no default bitrate if decoding */
         st->codec->bit_rate = 0;