aboutsummaryrefslogtreecommitdiffstats
path: root/src/audioOutputs
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2007-01-14 02:08:29 +0000
committerEric Wong <normalperson@yhbt.net>2007-01-14 02:08:29 +0000
commit3c2d123ab95227f7382fbaef56f25318b57d4ea8 (patch)
tree558b4b9264cc7cd5dc0c649f7a2bf2b2c7541281 /src/audioOutputs
parentf894e989509f8e484276ad6ec1fbbac238d78dd1 (diff)
downloadmpd-3c2d123ab95227f7382fbaef56f25318b57d4ea8.tar.gz
mpd-3c2d123ab95227f7382fbaef56f25318b57d4ea8.tar.xz
mpd-3c2d123ab95227f7382fbaef56f25318b57d4ea8.zip
jack: fix double-free in finish routine
git-svn-id: https://svn.musicpd.org/mpd/trunk@5252 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/audioOutputs')
-rw-r--r--src/audioOutputs/audioOutput_jack.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/audioOutputs/audioOutput_jack.c b/src/audioOutputs/audioOutput_jack.c
index c5eeab728..9c59c5994 100644
--- a/src/audioOutputs/audioOutput_jack.c
+++ b/src/audioOutputs/audioOutput_jack.c
@@ -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])