pcm_buffer: set size after allocation

When I implemented the pcm_buffer library, I forgot to set the new
buffer size.  This caused a new allocation in each pcm_buffer_get(),
fortunately no memory was leaked.
This commit is contained in:
Max Kellermann 2009-02-17 18:27:00 +01:00
parent d8db46edfa
commit ac3e2de28b

View File

@ -65,7 +65,8 @@ pcm_buffer_get(struct pcm_buffer *buffer, size_t size)
g_free(buffer->buffer);
/* allocate a new buffer; align at 64kB boundaries */
buffer->buffer = g_malloc((size | 0xffff) + 1);
buffer->size = (size | 0xffff) + 1;
buffer->buffer = g_malloc(buffer->size);
}
return buffer->buffer;