mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-19 05:55:07 +00:00
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;
|
||||
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++;
|
||||
|
Loading…
Reference in New Issue
Block a user