Commit b6c7bd53 authored by Martin Storsjö's avatar 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: 's avatarMartin Storsjö <martin@martin.st>
parent f2b00a53
...@@ -105,9 +105,11 @@ static void sample_queue_push(HintSampleQueue *queue, uint8_t *data, int size, ...@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment