diff mbox series

[PULL,6/6] audio: Convert use of atoi to qemu_strtoi

Message ID 20180625131253.11218-7-kraxel@redhat.com
State New
Headers show
Series [PULL,1/6] audio/hda: create millisecond timers that handle IO | expand

Commit Message

Gerd Hoffmann June 25, 2018, 1:12 p.m. UTC
From: Nia Alarie <nia.alarie@gmail.com>

If qemu_strtoi indicates an error, return the default value.

Signed-off-by: Nia Alarie <nia.alarie@gmail.com>
Message-Id: <20180316144047.30904-1-nia.alarie@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 audio/audio.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/audio/audio.c b/audio/audio.c
index 6eccdb17ee..d6e91901aa 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -335,9 +335,8 @@  static int audio_get_conf_int (const char *key, int defval, int *defaultp)
     char *strval;
 
     strval = getenv (key);
-    if (strval) {
+    if (strval && !qemu_strtoi(strval, NULL, 10, &val)) {
         *defaultp = 0;
-        val = atoi (strval);
         return val;
     }
     else {