matroskadec: check av_strdup() when setting defaults

This commit is contained in:
Anton Khirnov 2013-09-04 08:55:17 +02:00
parent 58894ab3f9
commit 668643b923
1 changed files with 7 additions and 1 deletions

View File

@ -851,7 +851,13 @@ static int ebml_parse_nest(MatroskaDemuxContext *matroska, EbmlSyntax *syntax,
break;
case EBML_STR:
case EBML_UTF8:
*(char **)((char *)data+syntax[i].data_offset) = av_strdup(syntax[i].def.s);
// the default may be NULL
if (syntax[i].def.s) {
uint8_t **dst = (uint8_t**)((uint8_t*)data + syntax[i].data_offset);
*dst = av_strdup(syntax[i].def.s);
if (!*dst)
return AVERROR(ENOMEM);
}
break;
}