1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

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>
This commit is contained in:
Martin Storsjö 2013-09-22 18:31:54 +03:00
parent f2b00a5372
commit b6c7bd53f4

View File

@ -105,9 +105,11 @@ static void sample_queue_push(HintSampleQueue *queue, uint8_t *data, int size,
return; return;
if (!queue->samples || queue->len >= queue->size) { if (!queue->samples || queue->len >= queue->size) {
queue->size += 10; 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; return;
} }
}
queue->samples[queue->len].data = data; queue->samples[queue->len].data = data;
queue->samples[queue->len].size = size; queue->samples[queue->len].size = size;
queue->samples[queue->len].sample_number = sample; queue->samples[queue->len].sample_number = sample;