movenchint: Clear size and len if the realloc failed
authorMartin Storsjö <martin@martin.st>
Sun, 22 Sep 2013 15:31:54 +0000 (18:31 +0300)
committerMartin Storsjö <martin@martin.st>
Sun, 22 Sep 2013 18:02:52 +0000 (21:02 +0300)
Previously these were left in an inconsistent state.

Pointed out by Michael Niedermayer.

Signed-off-by: Martin Storsjö <martin@martin.st>
libavformat/movenchint.c

index 4570815..a8f5f34 100644 (file)
@@ -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;