mirror of https://git.ffmpeg.org/ffmpeg.git
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:
parent
cbe47b1e84
commit
32805f8521
|
@ -945,16 +945,15 @@ static int ebml_parse_elem(MatroskaDemuxContext *matroska,
|
||||||
uint32_t id = syntax->id;
|
uint32_t id = syntax->id;
|
||||||
uint64_t length;
|
uint64_t length;
|
||||||
int res;
|
int res;
|
||||||
|
void *newelem;
|
||||||
|
|
||||||
data = (char *)data + syntax->data_offset;
|
data = (char *)data + syntax->data_offset;
|
||||||
if (syntax->list_elem_size) {
|
if (syntax->list_elem_size) {
|
||||||
EbmlList *list = data;
|
EbmlList *list = data;
|
||||||
if ((res = av_reallocp_array(&list->elem,
|
newelem = av_realloc(list->elem, (list->nb_elem+1)*syntax->list_elem_size);
|
||||||
list->nb_elem + 1,
|
if (!newelem)
|
||||||
syntax->list_elem_size)) < 0) {
|
return AVERROR(ENOMEM);
|
||||||
list->nb_elem = 0;
|
list->elem = newelem;
|
||||||
return res;
|
|
||||||
}
|
|
||||||
data = (char*)list->elem + list->nb_elem*syntax->list_elem_size;
|
data = (char*)list->elem + list->nb_elem*syntax->list_elem_size;
|
||||||
memset(data, 0, syntax->list_elem_size);
|
memset(data, 0, syntax->list_elem_size);
|
||||||
list->nb_elem++;
|
list->nb_elem++;
|
||||||
|
|
Loading…
Reference in New Issue