aboutsummaryrefslogtreecommitdiffstats
path: root/src/audioOutput.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-04-12 04:16:03 +0000
committerEric Wong <normalperson@yhbt.net>2008-04-12 04:16:03 +0000
commitc9d80d609057a0b34d1cb7caba34f8071c92122b (patch)
tree2767b4c03b9fc578002e9f2f5434f44562444345 /src/audioOutput.c
parent1d18ca69092c4ea25aea7da87907c879af435a3d (diff)
downloadmpd-c9d80d609057a0b34d1cb7caba34f8071c92122b.tar.gz
mpd-c9d80d609057a0b34d1cb7caba34f8071c92122b.tar.xz
mpd-c9d80d609057a0b34d1cb7caba34f8071c92122b.zip
use free()/malloc() instead of realloc()
When growing the audioOutput->convBuffer, we can use free()+malloc() instead of realloc(), which saves a memcpy(). git-svn-id: https://svn.musicpd.org/mpd/trunk@7295 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--src/audioOutput.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/audioOutput.c b/src/audioOutput.c
index 964042597..ba9032713 100644
--- a/src/audioOutput.c
+++ b/src/audioOutput.c
@@ -189,8 +189,9 @@ static void convertAudioFormat(AudioOutput * audioOutput,
&(audioOutput->outAudioFormat));
if (size > audioOutput->convBufferLen) {
- audioOutput->convBuffer =
- xrealloc(audioOutput->convBuffer, size);
+ if (audioOutput->convBuffer != NULL)
+ free(audioOutput->convBuffer);
+ audioOutput->convBuffer = xmalloc(size);
audioOutput->convBufferLen = size;
}