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>
pull/36/head
Martin Storsjö 12 years ago
parent f2b00a5372
commit b6c7bd53f4
  1. 4
      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;

Loading…
Cancel
Save