From a66893ac949864352b36b39e48c4cd72bbd81e54 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 12 Dec 2014 22:22:55 +0100 Subject: [PATCH] avformat/utils: check for malloc failure Signed-off-by: Michael Niedermayer --- libavformat/utils.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavformat/utils.c b/libavformat/utils.c index 5a2a72d6d0..8aee511f51 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -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;