avformat/matroskadec: ebml_parse_elem() should not deallocate priorly existing lists...
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 11 Sep 2013 10:13:44 +0000 (12:13 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 11 Sep 2013 10:15:08 +0000 (12:15 +0200)
This reverts a hunk from "avformat: Use av_reallocp_array() where suitable"

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/matroskadec.c

index 0e97d88..50cb51b 100644 (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++;