jack: fix double-free in finish routine

git-svn-id: https://svn.musicpd.org/mpd/trunk@5252 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
Eric Wong 2007-01-14 02:08:29 +00:00
parent f894e98950
commit 3c2d123ab9

View File

@ -64,6 +64,7 @@ static JackData *newJackData(void)
static void jack_finishDriver(AudioOutput * audioOutput)
{
JackData *jd = audioOutput->data;
int i;
if (jd && jd->client) {
jack_deactivate(jd->client);
@ -71,9 +72,17 @@ static void jack_finishDriver(AudioOutput * audioOutput)
}
ERROR("disconnect_jack (pid=%d)\n", getpid ());
if ( strcmp(name, "mpd") ) free(name);
if ( output_ports[0] ) free(output_ports[0]);
if ( output_ports[1] ) free(output_ports[1]);
if (strcmp(name, "mpd")) {
free(name);
name = "mpd";
}
for (i = ARRAY_SIZE(output_ports); --i >= 0; ) {
if (!output_ports[i])
continue;
free(output_ports[i]);
output_ports[i] = NULL;
}
if (jd) {
if (jd->ringbuffer[0])