[FFmpeg-cvslog] libavformat: Check for malloc failures in avformat_new_stream
Martin Storsjö
git at videolan.org
Sat Jan 17 22:56:18 CET 2015
ffmpeg | branch: release/2.4 | Martin Storsjö <martin at martin.st> | Sat Jan 3 21:27:21 2015 +0200| [932caa50a5dec7f2a69da8a417ccae84d19ae5e5] | committer: Luca Barbato
libavformat: Check for malloc failures in avformat_new_stream
CC: libav-stable at libav.org
Signed-off-by: Martin Storsjö <martin at martin.st>
(cherry picked from commit 9f810a9b374e0ff8e2a19fd8a7347afe2933e229)
Signed-off-by: Luca Barbato <lu_zero at gentoo.org>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=932caa50a5dec7f2a69da8a417ccae84d19ae5e5
---
libavformat/utils.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 973ab94..73e3039 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2535,6 +2535,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