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.
This commit is contained in:
parent
3d2c8b001a
commit
74273d419a
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user