aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2015-01-03 21:27:21 +0200
committerMartin Storsjö <martin@martin.st>2015-01-04 20:04:36 +0200
commit9f810a9b374e0ff8e2a19fd8a7347afe2933e229 (patch)
tree9724979a95b2c387fd4fa5c0118011ccd99efaa5
parentc4aa0f865fb2c3b28a309d1bb27fd1c24b75ba28 (diff)
downloadffmpeg-9f810a9b374e0ff8e2a19fd8a7347afe2933e229.tar.gz
libavformat: Check for malloc failures in avformat_new_stream
CC: libav-stable@libav.org Signed-off-by: Martin Storsjö <martin@martin.st>
-rw-r--r--libavformat/utils.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 3ea0ebd9d6..ce715f725c 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;