Commit 63b55b9a authored by Max Kellermann's avatar Max Kellermann Committed by Eric Wong

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
parent d3f72d10
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment