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

wm4 git at videolan.org
Sat Dec 13 00:27:51 CET 2014


ffmpeg | branch: master | wm4 <nfxjfg at googlemail.com> | Fri Dec 12 22:22:55 2014 +0100| [a66893ac949864352b36b39e48c4cd72bbd81e54] | committer: Michael Niedermayer

avformat/utils: check for malloc failure

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

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

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

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 5a2a72d..8aee511 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;



More information about the ffmpeg-cvslog mailing list