aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2015-01-03 21:27:21 +0200
committerLuca Barbato <lu_zero@gentoo.org>2015-01-12 22:19:11 +0100
commit932caa50a5dec7f2a69da8a417ccae84d19ae5e5 (patch)
tree5548d086b8f02e79a9249951b2212007efb3d89c
parent883795fb0face00a07349fbd32f4775431a9f30d (diff)
downloadffmpeg-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.c5
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;