[FFmpeg-cvslog] avformat/utils: check for malloc failure

wm4 git at videolan.org
Thu Feb 12 18:11:47 CET 2015


ffmpeg | branch: release/2.5 | wm4 <nfxjfg at googlemail.com> | Fri Dec 12 22:22:55 2014 +0100| [7caee172049a80e8c048e3d04202d409a06beeca] | committer: Michael Niedermayer

avformat/utils: check for malloc failure

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit a66893ac949864352b36b39e48c4cd72bbd81e54)

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

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

 libavformat/utils.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 5a282a7c..5662092 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3650,6 +3650,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;



More information about the ffmpeg-cvslog mailing list