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

wm4 git at videolan.org
Sat Jan 17 22:56:18 CET 2015


ffmpeg | branch: release/2.4 | wm4 <nfxjfg at googlemail.com> | Fri Dec 12 22:22:55 2014 +0100| [b96163f055ee44484ca4a06382221c2abb1e0914] | 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=b96163f055ee44484ca4a06382221c2abb1e0914
---

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

diff --git a/libavformat/utils.c b/libavformat/utils.c
index b1f7909..b399ccd 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3610,6 +3610,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