From: Clemens Ladisch Date: Wed, 24 Nov 2004 16:31:56 +0000 (+0000) Subject: fix miscalculation of buffer size in snd_output_buffer_need() X-Git-Tag: v1.0.8~30 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=290541d0ae5b9119b9e3aab20bf56753c23c5c22;p=alsa-lib.git fix miscalculation of buffer size in snd_output_buffer_need() snd_output_buffer_need() did not account for the already used part of the buffer when trying to allocating new space. --- diff --git a/src/output.c b/src/output.c index 071113bd..93530cd9 100644 --- a/src/output.c +++ b/src/output.c @@ -258,7 +258,7 @@ static int snd_output_buffer_need(snd_output_t *output, size_t size) alloc = 256; else alloc = buffer->alloc; - while (alloc < size) + while (alloc < buffer->size + size) alloc *= 2; buf = realloc(buffer->buf, alloc); if (!buf)