[FFmpeg-cvslog] libavformat: Check for malloc failures in avformat_new_stream
Martin Storsjö
git at videolan.org
Mon Jan 5 16:03:36 CET 2015
ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Sat Jan 3 21:27:21 2015 +0200| [9f810a9b374e0ff8e2a19fd8a7347afe2933e229] | committer: Martin Storsjö
libavformat: Check for malloc failures in avformat_new_stream
CC: libav-stable at libav.org
Signed-off-by: Martin Storsjö <martin at martin.st>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9f810a9b374e0ff8e2a19fd8a7347afe2933e229
---
libavformat/utils.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 3ea0ebd..ce715f7 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2525,6 +2525,11 @@ AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c)
}
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