[vlc-commits] PulseAudio: fix segmentation fault

Juergen Lock git at videolan.org
Sat Nov 17 22:53:52 CET 2012


vlc | branch: master | Juergen Lock <nox at jelal.kn-bremen.de> | Sat Nov 17 23:49:04 2012 +0200| [7751dc1fb827256b226fe49bd99fe6a5f37f5c8a] | committer: Rémi Denis-Courmont

PulseAudio: fix segmentation fault

Reported by: Rainer Hurling
Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

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

 modules/audio_output/vlcpulse.c |   14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/modules/audio_output/vlcpulse.c b/modules/audio_output/vlcpulse.c
index 5d3a784..f00775a 100644
--- a/modules/audio_output/vlcpulse.c
+++ b/modules/audio_output/vlcpulse.c
@@ -123,10 +123,13 @@ pa_context *vlc_pa_connect (vlc_object_t *obj, pa_threaded_mainloop **mlp)
             struct passwd pwbuf, *pw;
             char buf[len];
 
-            if (getpwuid_r (getuid (), &pwbuf, buf, sizeof (buf), &pw) == 0
-             && pw != NULL)
-                pa_proplist_sets (props, PA_PROP_APPLICATION_PROCESS_USER,
-                                  pw->pw_name);
+            if (getpwuid_r (getuid (), &pwbuf, buf, sizeof (buf), &pw) == 0)
+            {
+                if (pw != NULL)
+                    pa_proplist_sets (props, PA_PROP_APPLICATION_PROCESS_USER,
+                                      pw->pw_name);
+                break;
+            }
         }
 
         for (size_t max = sysconf (_SC_HOST_NAME_MAX), len = max % 1024 + 1024;
@@ -135,8 +138,11 @@ pa_context *vlc_pa_connect (vlc_object_t *obj, pa_threaded_mainloop **mlp)
             char hostname[len];
 
             if (gethostname (hostname, sizeof (hostname)) == 0)
+            {
                 pa_proplist_sets (props, PA_PROP_APPLICATION_PROCESS_HOST,
                                   hostname);
+                break;
+            }
         }
 
         const char *session = getenv ("XDG_SESSION_COOKIE");



More information about the vlc-commits mailing list