From b6c7bd53f4ba3dd3400f4422b65ee844678c6b72 Mon Sep 17 00:00:00 2001 From: Martin Storsjö Date: Sun, 22 Sep 2013 18:31:54 +0300 Subject: movenchint: Clear size and len if the realloc failed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously these were left in an inconsistent state. Pointed out by Michael Niedermayer. Signed-off-by: Martin Storsjö --- libavformat/movenchint.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'libavformat') diff --git a/libavformat/movenchint.c b/libavformat/movenchint.c index 457081582a..a8f5f34f9c 100644 --- a/libavformat/movenchint.c +++ b/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; -- cgit v1.2.3