aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-04-12 04:11:17 +0000
committerEric Wong <normalperson@yhbt.net>2008-04-12 04:11:17 +0000
commit63b55b9a48bfa59f541adab8629d9927e040c714 (patch)
tree080c4c096d608166b920e1e3847350131a3bc98c
parentd3f72d102325ff8ad1f41087f9327ae9fa228b6b (diff)
downloadmpd-63b55b9a48bfa59f541adab8629d9927e040c714.tar.gz
mpd-63b55b9a48bfa59f541adab8629d9927e040c714.tar.xz
mpd-63b55b9a48bfa59f541adab8629d9927e040c714.zip
use free()+malloc() instead of realloc()
realloc() has to copy data to the new buffer. Since convBuffer contains temporary data only, we can safely use free() plus a new malloc(), which saves the mempy(). git-svn-id: https://svn.musicpd.org/mpd/trunk@7246 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--src/outputBuffer.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/outputBuffer.c b/src/outputBuffer.c
index b478c2c52..04641faa3 100644
--- a/src/outputBuffer.c
+++ b/src/outputBuffer.c
@@ -76,7 +76,9 @@ int sendDataToOutputBuffer(OutputBuffer * cb, InputStream * inStream,
datalen = pcm_sizeOfConvBuffer(&(dc->audioFormat), dataInLen,
&(cb->audioFormat));
if (datalen > convBufferLen) {
- convBuffer = xrealloc(convBuffer, datalen);
+ if (convBuffer != NULL)
+ free(convBuffer);
+ convBuffer = xmalloc(datalen);
convBufferLen = datalen;
}
data = convBuffer;