From 77dd16bace3e70599cab1a36fe94565bca717227 Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Duraffort?= Date: Sun, 11 Jul 2010 08:45:57 +0200 Subject: [PATCH] pulse: fix a memory leak. --- modules/audio_output/pulse.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/audio_output/pulse.c b/modules/audio_output/pulse.c index 19c290e95f..4a239640a6 100644 --- a/modules/audio_output/pulse.c +++ b/modules/audio_output/pulse.c @@ -118,7 +118,7 @@ static int Open ( vlc_object_t *p_this ) const struct pa_buffer_attr *buffer_attr; struct pa_buffer_attr a; struct pa_channel_map map; - char * p_client_name = NULL; + char * p_client_name; if( !vlc_xlib_init( p_this ) ) return VLC_EGENERIC; @@ -213,7 +213,10 @@ static int Open ( vlc_object_t *p_this ) goto fail; } - if (!(p_sys->context = pa_context_new(pa_threaded_mainloop_get_api(p_sys->mainloop), p_client_name))) { + p_sys->context = pa_context_new(pa_threaded_mainloop_get_api(p_sys->mainloop), p_client_name); + free(p_client_name); + if(!p_sys->context) + { msg_Err(p_aout, "Failed to allocate context"); goto fail; } @@ -306,7 +309,6 @@ unlock_and_fail: if (p_sys->mainloop) pa_threaded_mainloop_unlock(p_sys->mainloop); fail: - free(p_client_name); msg_Dbg(p_aout, "Pulse initialization failed"); uninit(p_aout); return VLC_EGENERIC; -- 2.39.2