avformat/matroskadec: Check avpriv_new_chapter() for failure

Fixes null pointer dereference

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Justin Jacobs 2014-08-06 20:04:38 -04:00 committed by Michael Niedermayer
parent 1ba7c6ead2
commit 87dc8b3af9

View File

@ -2161,8 +2161,10 @@ static int matroska_read_header(AVFormatContext *s)
(AVRational) { 1, 1000000000 },
chapters[i].start, chapters[i].end,
chapters[i].title);
av_dict_set(&chapters[i].chapter->metadata,
"title", chapters[i].title, 0);
if (chapters[i].chapter) {
av_dict_set(&chapters[i].chapter->metadata,
"title", chapters[i].title, 0);
}
max_start = chapters[i].start;
}