]> git.alsa-project.org Git - alsa-lib.git/commitdiff
fix miscalculation of buffer size in snd_output_buffer_need()
authorClemens Ladisch <clemens@ladisch.de>
Wed, 24 Nov 2004 16:31:56 +0000 (16:31 +0000)
committerClemens Ladisch <clemens@ladisch.de>
Wed, 24 Nov 2004 16:31:56 +0000 (16:31 +0000)
snd_output_buffer_need() did not account for the already used part of
the buffer when trying to allocating new space.

src/output.c

index 071113bd63dab7c2498a0f27aa52d41b90c2690c..93530cd950a7dbd035e3c904038690192e000fa5 100644 (file)
@@ -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)