Browse Source

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@martin.st>
tags/n2.1
Martin Storsjö 12 years ago
parent
commit
b6c7bd53f4
1 changed files with 3 additions and 1 deletions
  1. +3
    -1
      libavformat/movenchint.c

+ 3
- 1
libavformat/movenchint.c View 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;


Loading…
Cancel
Save