vlc/vlc-1.1 | branch: master | Rémi Duraffort <[email protected]> | Sun Jul 
11 08:45:57 2010 +0200| [b1d6e1fc72a87064b60639e68a9d163e9a93b0e9] | committer: 
Jean-Baptiste Kempf 

pulse: fix a memory leak.
(cherry picked from commit 77dd16bace3e70599cab1a36fe94565bca717227)

Signed-off-by: Jean-Baptiste Kempf <[email protected]>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.1.git/?a=commit;h=b1d6e1fc72a87064b60639e68a9d163e9a93b0e9
---

 modules/audio_output/pulse.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/modules/audio_output/pulse.c b/modules/audio_output/pulse.c
index d101231..367dead 100644
--- a/modules/audio_output/pulse.c
+++ b/modules/audio_output/pulse.c
@@ -119,7 +119,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;
@@ -214,7 +214,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;
     }
@@ -307,7 +310,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;

_______________________________________________
vlc-commits mailing list
[email protected]
http://mailman.videolan.org/listinfo/vlc-commits

Reply via email to