summaryrefslogtreecommitdiffstats
path: root/pulse/pcm_pulse.c
diff options
context:
space:
mode:
Diffstat (limited to 'pulse/pcm_pulse.c')
-rw-r--r--pulse/pcm_pulse.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/pulse/pcm_pulse.c b/pulse/pcm_pulse.c
index 98983f8..02a837e 100644
--- a/pulse/pcm_pulse.c
+++ b/pulse/pcm_pulse.c
@@ -819,21 +819,22 @@ static int pulse_close(snd_pcm_ioplug_t * io)
assert(pcm);
- pa_threaded_mainloop_lock(pcm->p->mainloop);
+ if (pcm->p && pcm->p->mainloop) {
- if (pcm->stream) {
- pa_stream_disconnect(pcm->stream);
- pa_stream_unref(pcm->stream);
- }
+ pa_threaded_mainloop_lock(pcm->p->mainloop);
- pa_threaded_mainloop_unlock(pcm->p->mainloop);
+ if (pcm->stream) {
+ pa_stream_disconnect(pcm->stream);
+ pa_stream_unref(pcm->stream);
+ }
+
+ pa_threaded_mainloop_unlock(pcm->p->mainloop);
+ }
if (pcm->p)
pulse_free(pcm->p);
- if (pcm->device)
- free(pcm->device);
-
+ free(pcm->device);
free(pcm);
return 0;