Commit 74273d41 authored by Max Kellermann's avatar Max Kellermann

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.
parent 3d2c8b00
...@@ -236,11 +236,17 @@ pulse_mixer_open(G_GNUC_UNUSED struct mixer *data) ...@@ -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), if(!(pm->context = pa_context_new(pa_threaded_mainloop_get_api(pm->mainloop),
"Mixer mpd"))) { "Mixer mpd"))) {
pa_threaded_mainloop_stop(pm->mainloop);
pa_threaded_mainloop_free(pm->mainloop);
g_debug("failed context"); g_debug("failed context");
return false; return false;
} }
if (!pulse_mixer_setup(pm)) { 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; return false;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment