diff options
author | Ronald S. Bultje <rsbultje@gmail.com> | 2011-05-03 16:19:42 +0400 |
---|---|---|
committer | Ronald S. Bultje <rsbultje@gmail.com> | 2011-05-04 06:29:19 +0400 |
commit | 76432655056b9c1477ade550e4b6d277556eb6b2 (patch) | |
tree | 1306ab01f3be28ad3c2ee5489e724554204db33d /libavformat | |
parent | f8af93ab99a132c268e4ce83736762555e928b96 (diff) |
nutenc: check malloc return values.
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/nutenc.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c index 4ca761ab40..85340b158e 100644 --- a/libavformat/nutenc.c +++ b/libavformat/nutenc.c @@ -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]; |