summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--jack/pcm_jack.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/jack/pcm_jack.c b/jack/pcm_jack.c
index 31cf050..4350302 100644
--- a/jack/pcm_jack.c
+++ b/jack/pcm_jack.c
@@ -61,8 +61,10 @@ static void snd_pcm_jack_free(snd_pcm_jack_t *jack)
free(jack->port_names[i]);
free(jack->port_names);
}
- close(jack->fd);
- close(jack->io.poll_fd);
+ if (jack->fd >= 0)
+ close(jack->fd);
+ if (jack->io.poll_fd >= 0)
+ close(jack->io.poll_fd);
free(jack->areas);
free(jack);
}
@@ -321,6 +323,9 @@ static int snd_pcm_jack_open(snd_pcm_t **pcmp, const char *name,
if (!jack)
return -ENOMEM;
+ jack->fd = -1;
+ jack->io.poll_fd = -1;
+
err = parse_ports(jack, stream == SND_PCM_STREAM_PLAYBACK ?
playback_conf : capture_conf);
if (err) {