qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [COMMIT a628b86] oss/alsa: Do not invoke UB described in


From: Anthony Liguori
Subject: [Qemu-commits] [COMMIT a628b86] oss/alsa: Do not invoke UB described in 7.15.1.1(this time for ADC)
Date: Fri, 02 Oct 2009 23:36:29 -0000

From: malc <address@hidden>

Signed-off-by: malc <address@hidden>

diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c
index 0ef89e9..7698d10 100644
--- a/audio/alsaaudio.c
+++ b/audio/alsaaudio.c
@@ -1079,23 +1079,26 @@ static int alsa_read (SWVoiceIn *sw, void *buf, int 
size)
 
 static int alsa_ctl_in (HWVoiceIn *hw, int cmd, ...)
 {
-    va_list ap;
-    int poll_mode;
     ALSAVoiceIn *alsa = (ALSAVoiceIn *) hw;
 
-    va_start (ap, cmd);
-    poll_mode = va_arg (ap, int);
-    va_end (ap);
-
     switch (cmd) {
     case VOICE_ENABLE:
-        ldebug ("enabling voice\n");
-        if (poll_mode && alsa_poll_in (hw)) {
-            poll_mode = 0;
-        }
-        hw->poll_mode = poll_mode;
+        {
+            va_list ap;
+            int poll_mode;
 
-        return alsa_voice_ctl (alsa->handle, "capture", 0);
+            va_start (ap, cmd);
+            poll_mode = va_arg (ap, int);
+            va_end (ap);
+
+            ldebug ("enabling voice\n");
+            if (poll_mode && alsa_poll_in (hw)) {
+                poll_mode = 0;
+            }
+            hw->poll_mode = poll_mode;
+
+            return alsa_voice_ctl (alsa->handle, "capture", 0);
+        }
 
     case VOICE_DISABLE:
         ldebug ("disabling voice\n");
diff --git a/audio/ossaudio.c b/audio/ossaudio.c
index dae25e9..4002f14 100644
--- a/audio/ossaudio.c
+++ b/audio/ossaudio.c
@@ -781,20 +781,23 @@ static int oss_read (SWVoiceIn *sw, void *buf, int size)
 
 static int oss_ctl_in (HWVoiceIn *hw, int cmd, ...)
 {
-    va_list ap;
-    int poll_mode;
     OSSVoiceIn *oss = (OSSVoiceIn *) hw;
 
-    va_start (ap, cmd);
-    poll_mode = va_arg (ap, int);
-    va_end (ap);
-
     switch (cmd) {
     case VOICE_ENABLE:
-        if (poll_mode && oss_poll_in (hw)) {
-            poll_mode = 0;
+        {
+            va_list ap;
+            int poll_mode;
+
+            va_start (ap, cmd);
+            poll_mode = va_arg (ap, int);
+            va_end (ap);
+
+            if (poll_mode && oss_poll_in (hw)) {
+                poll_mode = 0;
+            }
+            hw->poll_mode = poll_mode;
         }
-        hw->poll_mode = poll_mode;
         break;
 
     case VOICE_DISABLE:




reply via email to

[Prev in Thread] Current Thread [Next in Thread]