]> git.sesse.net Git - vlc/commitdiff
pulse: fix a memory leak.
authorRémi Duraffort <ivoire@videolan.org>
Sun, 11 Jul 2010 06:45:57 +0000 (08:45 +0200)
committerRémi Duraffort <ivoire@videolan.org>
Sun, 11 Jul 2010 06:45:57 +0000 (08:45 +0200)
modules/audio_output/pulse.c

index 19c290e95f3bd811f5583f3b718bb08a37962b61..4a239640a6ce841c201f26baaf706ef38878b4f4 100644 (file)
@@ -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;