From 9fda18663f31e67d8c1c50e1c5a1888abceda2a6 Mon Sep 17 00:00:00 2001 From: Leandro Pereira Date: Sun, 15 Aug 2010 18:36:25 -0300 Subject: Fix potential problems found by clang static analyzer. --- modules/devices/inputdevices.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'modules/devices/inputdevices.c') diff --git a/modules/devices/inputdevices.c b/modules/devices/inputdevices.c index c280e218..31f51fbb 100644 --- a/modules/devices/inputdevices.c +++ b/modules/devices/inputdevices.c @@ -46,7 +46,7 @@ __scan_input_devices(void) FILE *dev; gchar buffer[128]; gchar *tmp, *name = NULL, *phys = NULL; - gint bus, vendor, product, version; + gint bus = 0, vendor, product, version; int d = 0, n = 0; dev = fopen("/proc/bus/input/devices", "r"); @@ -87,7 +87,7 @@ __scan_input_devices(void) d = 4; //INPUT_UNKNOWN; break; case '\n': - if (strstr(name, "PC Speaker")) { + if (name && strstr(name, "PC Speaker")) { d = 3; // INPUT_PCSPKR } @@ -123,12 +123,12 @@ __scan_input_devices(void) "Version=0x%x\n", strhash, product, version); - if (phys[1] != 0) { + if (phys && phys[1] != 0) { strhash = h_strdup_cprintf("Connected to=%s\n", strhash, phys); } - if (strstr(phys,"ir")) { + if (phys && strstr(phys, "ir")) { strhash = h_strdup_cprintf("InfraRed port=yes\n", strhash); } -- cgit v1.2.3