avformat/utils: check for malloc failure

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
wm4 2014-12-12 22:22:55 +01:00 committed by Michael Niedermayer
parent ce35a61399
commit a66893ac94
1 changed files with 5 additions and 0 deletions

View File

@ -3652,6 +3652,11 @@ AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c)
st->info->last_dts = AV_NOPTS_VALUE;
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;