[vlc-commits] commit: pulse: fix a memory leak. ( Rémi Duraffort )

git at videolan.org git at videolan.org
Sun Jul 11 09:24:47 CEST 2010


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Sun Jul 11 08:45:57 2010 +0200| [77dd16bace3e70599cab1a36fe94565bca717227] | committer: Rémi Duraffort 

pulse: fix a memory leak.

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

 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 19c290e..4a23964 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;



More information about the vlc-commits mailing list