From 74273d419a7157d59682abc9a459cbeb793858c4 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 26 Mar 2009 19:49:58 +0100 Subject: 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. --- src/mixer/pulse_mixer.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/mixer') 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; } -- cgit v1.2.3