[vlc-commits] PulseAudio: fix segmentation fault

Juergen Lock git at videolan.org
Sat Nov 17 23:01:13 CET 2012


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

PulseAudio: fix segmentation fault

Reported by: Rainer Hurling
Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>
(cherry picked from commit 7751dc1fb827256b226fe49bd99fe6a5f37f5c8a)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=395d3bfc2bd75712aa28230f93d6a2c68ecd5d87
---

 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 e4c35e1..0a45deb 100644
--- a/modules/audio_output/vlcpulse.c
+++ b/modules/audio_output/vlcpulse.c
@@ -113,10 +113,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;
@@ -125,8 +128,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