matroskadec: Free ebml binary buffer on error
authorDavid Conrad <lessen42@gmail.com>
Tue, 18 May 2010 21:21:37 +0000 (21:21 +0000)
committerDavid Conrad <lessen42@gmail.com>
Tue, 18 May 2010 21:21:37 +0000 (21:21 +0000)
Based on a Chromium patch

Originally committed as revision 23169 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavformat/matroskadec.c

index 9126717..1bde1af 100644 (file)
@@ -641,8 +641,10 @@ static int ebml_read_binary(ByteIOContext *pb, int length, EbmlBin *bin)
 
     bin->size = length;
     bin->pos  = url_ftell(pb);
-    if (get_buffer(pb, bin->data, length) != length)
+    if (get_buffer(pb, bin->data, length) != length) {
+        av_freep(&bin->data);
         return AVERROR(EIO);
+    }
 
     return 0;
 }