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
This commit is contained in:
Max Kellermann 2008-04-12 04:11:17 +00:00 committed by Eric Wong
parent d3f72d1023
commit 63b55b9a48

View File

@ -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;