From 66e30a2e65e81a5abb9149fe8587355273cbb38f Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 26 Apr 2014 22:08:10 +0200 Subject: [PATCH] avformat/mpegtsenc: check avformat_new_stream() return Fixes CID1206645 Signed-off-by: Michael Niedermayer --- libavformat/mpegtsenc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index 2e04ea3085..47f0a784fd 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -700,6 +700,10 @@ static int mpegts_write_header(AVFormatContext *s) goto fail; } ast = avformat_new_stream(ts_st->amux, NULL); + if (!ast) { + ret = AVERROR(ENOMEM); + goto fail; + } ret = avcodec_copy_context(ast->codec, st->codec); if (ret != 0) goto fail;