diff options
author | Martin Storsjö <martin@martin.st> | 2013-09-22 18:31:54 +0300 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2013-09-22 21:02:52 +0300 |
commit | b6c7bd53f4ba3dd3400f4422b65ee844678c6b72 (patch) | |
tree | 51fe6deb864bfec1300242d070d1a50642569530 | |
parent | f2b00a5372bfa1d82a8ab99cb8eafac8a9473494 (diff) | |
download | ffmpeg-b6c7bd53f4ba3dd3400f4422b65ee844678c6b72.tar.gz |
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>
-rw-r--r-- | libavformat/movenchint.c | 4 |
1 files changed, 3 insertions, 1 deletions
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; |