[FFmpeg-cvslog] avformat/matroskadec: ebml_parse_elem() should not deallocate priorly existing lists on failure

Michael Niedermayer git at videolan.org
Wed Sep 11 12:31:35 CEST 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed Sep 11 12:13:44 2013 +0200| [32805f852116f792b85635680a804b10edf26210] | committer: Michael Niedermayer

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 at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=32805f852116f792b85635680a804b10edf26210
---

 libavformat/matroskadec.c |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 0e97d88..50cb51b 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -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++;



More information about the ffmpeg-cvslog mailing list