added output_buffer_free()
To do proper cleanup before exiting, we have to provide a destructor for OutputBuffer. One day, valgrind will not complain about memory leaks! git-svn-id: https://svn.musicpd.org/mpd/trunk@7315 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
parent
b688134586
commit
f2cdac6ee7
@ -36,6 +36,12 @@ void initOutputBuffer(OutputBuffer * cb, unsigned int size)
|
|||||||
cb->currentChunk = -1;
|
cb->currentChunk = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void output_buffer_free(OutputBuffer * cb)
|
||||||
|
{
|
||||||
|
assert(cb->chunks != NULL);
|
||||||
|
free(cb->chunks);
|
||||||
|
}
|
||||||
|
|
||||||
void clearOutputBuffer(OutputBuffer * cb)
|
void clearOutputBuffer(OutputBuffer * cb)
|
||||||
{
|
{
|
||||||
cb->end = cb->begin;
|
cb->end = cb->begin;
|
||||||
|
@ -62,6 +62,8 @@ typedef struct _OutputBuffer {
|
|||||||
|
|
||||||
void initOutputBuffer(OutputBuffer * cb, unsigned int size);
|
void initOutputBuffer(OutputBuffer * cb, unsigned int size);
|
||||||
|
|
||||||
|
void output_buffer_free(OutputBuffer * cb);
|
||||||
|
|
||||||
void clearOutputBuffer(OutputBuffer * cb);
|
void clearOutputBuffer(OutputBuffer * cb);
|
||||||
|
|
||||||
void flushOutputBuffer(OutputBuffer * cb);
|
void flushOutputBuffer(OutputBuffer * cb);
|
||||||
|
@ -116,5 +116,6 @@ void freePlayerData(void)
|
|||||||
* access playerData_pd and we need to keep it available for them */
|
* access playerData_pd and we need to keep it available for them */
|
||||||
waitpid(-1, NULL, 0);
|
waitpid(-1, NULL, 0);
|
||||||
|
|
||||||
|
output_buffer_free(&playerData_pd.buffer);
|
||||||
free(playerData_pd.audioDeviceStates);
|
free(playerData_pd.audioDeviceStates);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user