avformat/mpegtsenc: check avformat_new_stream() return

Fixes CID1206645
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-04-26 22:08:10 +02:00
parent 24725f8e09
commit 66e30a2e65
1 changed files with 4 additions and 0 deletions

View File

@ -700,6 +700,10 @@ static int mpegts_write_header(AVFormatContext *s)
goto fail; goto fail;
} }
ast = avformat_new_stream(ts_st->amux, NULL); ast = avformat_new_stream(ts_st->amux, NULL);
if (!ast) {
ret = AVERROR(ENOMEM);
goto fail;
}
ret = avcodec_copy_context(ast->codec, st->codec); ret = avcodec_copy_context(ast->codec, st->codec);
if (ret != 0) if (ret != 0)
goto fail; goto fail;