aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-02-17 18:27:00 +0100
committerMax Kellermann <max@duempel.org>2009-02-17 18:27:00 +0100
commitac3e2de28b4ff951306f669810e5e4269cfefb28 (patch)
treeb79a7de8199075fc14f7b4fd722ac203c6926f75
parentd8db46edfaed14c38d97e8880ff07fc629908b2d (diff)
downloadmpd-ac3e2de28b4ff951306f669810e5e4269cfefb28.tar.gz
mpd-ac3e2de28b4ff951306f669810e5e4269cfefb28.tar.xz
mpd-ac3e2de28b4ff951306f669810e5e4269cfefb28.zip
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.
Diffstat (limited to '')
-rw-r--r--src/pcm_buffer.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/pcm_buffer.h b/src/pcm_buffer.h
index 31975d5b6..85e8728f8 100644
--- a/src/pcm_buffer.h
+++ b/src/pcm_buffer.h
@@ -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;