[FFmpeg-cvslog] lavf/matroskadec: Use av_realloc() in get_qt_codec()

Mats Peterson git at videolan.org
Tue Jan 12 14:55:13 CET 2016


ffmpeg | branch: master | Mats Peterson <matsp888 at yahoo.com> | Mon Jan 11 07:43:29 2016 +0100| [adef8ee794aa1b09e2e6095a59b5a291635ac44f] | committer: Michael Niedermayer

lavf/matroskadec: Use av_realloc() in get_qt_codec()

Use av_realloc() rather than av_malloc() when normalizing noncompliant
private data in get_qt_codec().

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

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

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 9e9e074..cc5ec19 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1719,11 +1719,11 @@ static int get_qt_codec(MatroskaTrack *track, uint32_t *fourcc, enum AVCodecID *
      * by expanding/shifting the data by 4 bytes and storing the data
      * size at the start. */
     if (ff_codec_get_id(codec_tags, AV_RL32(track->codec_priv.data))) {
-        uint8_t *p = av_malloc(track->codec_priv.size + 4);
+        uint8_t *p = av_realloc(track->codec_priv.data,
+                                track->codec_priv.size + 4);
         if (!p)
             return AVERROR(ENOMEM);
-        memcpy(p + 4, track->codec_priv.data, track->codec_priv.size);
-        av_free(track->codec_priv.data);
+        memmove(p + 4, p, track->codec_priv.size);
         track->codec_priv.data = p;
         track->codec_priv.size += 4;
         AV_WB32(track->codec_priv.data, track->codec_priv.size);



More information about the ffmpeg-cvslog mailing list