This allows us to see if the later allcoation fails.
---
 libavformat/mov.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 6c3c95c..1f3f691 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -390,7 +390,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
                 if (len&1)
                     len += 1;
                 if (type == 2) { // absolute path
-                    av_free(dref->path);
+                    av_freep(&dref->path);
                     dref->path = av_mallocz(len+1);
                     if (!dref->path)
                         return AVERROR(ENOMEM);
@@ -405,7 +405,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
                             dref->path[j] = '/';
                     av_log(c->fc, AV_LOG_DEBUG, "path %s\n", dref->path);
                 } else if (type == 0) { // directory name
-                    av_free(dref->dir);
+                    av_freep(&dref->dir);
                     dref->dir = av_malloc(len+1);
                     if (!dref->dir)
                         return AVERROR(ENOMEM);
@@ -695,7 +695,7 @@ static int mov_read_smi(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 
     // currently SVQ3 decoder expect full STSD header - so let's fake it
     // this should be fixed and just SMI header should be passed
-    av_free(st->codec->extradata);
+    av_freep(&st->codec->extradata);
     st->codec->extradata = av_mallocz(atom.size + 0x5a + 
FF_INPUT_BUFFER_PADDING_SIZE);
     if (!st->codec->extradata)
         return AVERROR(ENOMEM);
@@ -776,7 +776,7 @@ static int mov_read_wave(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 
     if (st->codec->codec_id == CODEC_ID_QDM2 || st->codec->codec_id == 
CODEC_ID_QDMC) {
         // pass all frma atom to codec, needed at least for QDMC and QDM2
-        av_free(st->codec->extradata);
+        av_freep(&st->codec->extradata);
         st->codec->extradata = av_mallocz(atom.size + 
FF_INPUT_BUFFER_PADDING_SIZE);
         if (!st->codec->extradata)
             return AVERROR(ENOMEM);
@@ -805,7 +805,7 @@ static int mov_read_glbl(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
     if((uint64_t)atom.size > (1<<30))
         return -1;
 
-    av_free(st->codec->extradata);
+    av_freep(&st->codec->extradata);
     st->codec->extradata = av_mallocz(atom.size + 
FF_INPUT_BUFFER_PADDING_SIZE);
     if (!st->codec->extradata)
         return AVERROR(ENOMEM);
@@ -832,7 +832,7 @@ static int mov_read_strf(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
     if((uint64_t)atom.size > (1<<30))
         return -1;
 
-    av_free(st->codec->extradata);
+    av_freep(&st->codec->extradata);
     st->codec->extradata = av_mallocz(atom.size - 40 + 
FF_INPUT_BUFFER_PADDING_SIZE);
     if (!st->codec->extradata)
         return AVERROR(ENOMEM);
-- 
1.7.3.1

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to