[FFmpeg-cvslog] movenchint: Clear size and len if the realloc failed

Martin Storsjö git at videolan.org
Mon Sep 23 14:53:27 CEST 2013


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Sun Sep 22 18:31:54 2013 +0300| [b6c7bd53f4ba3dd3400f4422b65ee844678c6b72] | committer: Martin Storsjö

movenchint: Clear size and len if the realloc failed

Previously these were left in an inconsistent state.

Pointed out by Michael Niedermayer.

Signed-off-by: Martin Storsjö <martin at martin.st>

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

 libavformat/movenchint.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/movenchint.c b/libavformat/movenchint.c
index 4570815..a8f5f34 100644
--- a/libavformat/movenchint.c
+++ b/libavformat/movenchint.c
@@ -105,8 +105,10 @@ static void sample_queue_push(HintSampleQueue *queue, uint8_t *data, int size,
         return;
     if (!queue->samples || queue->len >= queue->size) {
         queue->size += 10;
-        if (av_reallocp(&queue->samples, sizeof(*queue->samples) * queue->size) < 0)
+        if (av_reallocp(&queue->samples, sizeof(*queue->samples) * queue->size) < 0) {
+            queue->len = queue->size = 0;
             return;
+        }
     }
     queue->samples[queue->len].data = data;
     queue->samples[queue->len].size = size;



More information about the ffmpeg-cvslog mailing list