diff options
author | Martin Storsjö <martin@martin.st> | 2015-01-03 21:27:21 +0200 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2015-01-12 22:19:11 +0100 |
commit | 932caa50a5dec7f2a69da8a417ccae84d19ae5e5 (patch) | |
tree | 5548d086b8f02e79a9249951b2212007efb3d89c | |
parent | 883795fb0face00a07349fbd32f4775431a9f30d (diff) | |
download | ffmpeg-932caa50a5dec7f2a69da8a417ccae84d19ae5e5.tar.gz |
libavformat: Check for malloc failures in avformat_new_stream
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 9f810a9b374e0ff8e2a19fd8a7347afe2933e229)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
-rw-r--r-- | libavformat/utils.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index 973ab94d6f..73e3039421 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; |