diff options
author | Max Kellermann <max@duempel.org> | 2009-03-26 19:49:58 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-03-26 19:49:58 +0100 |
commit | 74273d419a7157d59682abc9a459cbeb793858c4 (patch) | |
tree | 0a4fba148fb7183025f7bf1b9df4e48193982ffa /src/mixer | |
parent | 3d2c8b001a5d808ceab215ecdfbdead1d9d32cbc (diff) | |
download | mpd-74273d419a7157d59682abc9a459cbeb793858c4.tar.gz mpd-74273d419a7157d59682abc9a459cbeb793858c4.tar.xz mpd-74273d419a7157d59682abc9a459cbeb793858c4.zip |
pulse_mixer: free libpulse objects on failure
When the mixer initialization fails, we have to free the libpulse
objects we have already created, to prevent resource leaks.
Diffstat (limited to '')
-rw-r--r-- | src/mixer/pulse_mixer.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mixer/pulse_mixer.c b/src/mixer/pulse_mixer.c index a2a4444a9..ad84d7301 100644 --- a/src/mixer/pulse_mixer.c +++ b/src/mixer/pulse_mixer.c @@ -236,11 +236,17 @@ pulse_mixer_open(G_GNUC_UNUSED struct mixer *data) if(!(pm->context = pa_context_new(pa_threaded_mainloop_get_api(pm->mainloop), "Mixer mpd"))) { + pa_threaded_mainloop_stop(pm->mainloop); + pa_threaded_mainloop_free(pm->mainloop); g_debug("failed context"); return false; } if (!pulse_mixer_setup(pm)) { + pa_threaded_mainloop_stop(pm->mainloop); + pa_context_disconnect(pm->context); + pa_context_unref(pm->context); + pa_threaded_mainloop_free(pm->mainloop); return false; } |