nutenc: check malloc return values.

This commit is contained in:
Ronald S. Bultje 2011-05-03 08:19:42 -04:00
parent f8af93ab99
commit 7643265505
1 changed files with 6 additions and 0 deletions

View File

@ -588,6 +588,12 @@ static int write_header(AVFormatContext *s){
nut->chapter = av_mallocz(sizeof(ChapterContext)*s->nb_chapters);
nut->time_base= av_mallocz(sizeof(AVRational )*(s->nb_streams +
s->nb_chapters));
if (!nut->stream || (s->nb_chapters && !nut->chapter) || !nut->time_base) {
av_freep(&nut->stream);
av_freep(&nut->chapter);
av_freep(&nut->time_base);
return AVERROR(ENOMEM);
}
for(i=0; i<s->nb_streams; i++){
AVStream *st= s->streams[i];