avformat/matroskadec: ebml_parse_elem() should not deallocate priorly existing lists on failure

This reverts a hunk from "avformat: Use av_reallocp_array() where suitable"

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2013-09-11 12:13:44 +02:00
parent cbe47b1e84
commit 32805f8521

View File

@ -945,16 +945,15 @@ static int ebml_parse_elem(MatroskaDemuxContext *matroska,
uint32_t id = syntax->id;
uint64_t length;
int res;
void *newelem;
data = (char *)data + syntax->data_offset;
if (syntax->list_elem_size) {
EbmlList *list = data;
if ((res = av_reallocp_array(&list->elem,
list->nb_elem + 1,
syntax->list_elem_size)) < 0) {
list->nb_elem = 0;
return res;
}
newelem = av_realloc(list->elem, (list->nb_elem+1)*syntax->list_elem_size);
if (!newelem)
return AVERROR(ENOMEM);
list->elem = newelem;
data = (char*)list->elem + list->nb_elem*syntax->list_elem_size;
memset(data, 0, syntax->list_elem_size);
list->nb_elem++;