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:
parent
d3f72d1023
commit
63b55b9a48
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user