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/storage.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'modules/devices/storage.c') diff --git a/modules/devices/storage.c b/modules/devices/storage.c index 23ab1de2..a9dfd665 100644 --- a/modules/devices/storage.c +++ b/modules/devices/storage.c @@ -36,10 +36,10 @@ __scan_scsi_devices(void) FILE *proc_scsi; gchar buffer[256], *buf; gint n = 0; - gint scsi_controller; - gint scsi_channel; - gint scsi_id; - gint scsi_lun; + gint scsi_controller = 0; + gint scsi_channel = 0; + gint scsi_id = 0 ; + gint scsi_lun = 0; gchar *vendor = NULL, *revision = NULL, *model = NULL; gchar *scsi_storage_list; @@ -96,7 +96,7 @@ __scan_scsi_devices(void) }; int i; - if (strstr(model, "Flash Disk")) { + if (model && strstr(model, "Flash Disk")) { type = "Flash Disk"; icon = "usbfldisk"; } else { @@ -146,6 +146,8 @@ __scan_scsi_devices(void) g_free(model); g_free(revision); g_free(vendor); + + scsi_controller = scsi_channel = scsi_id = scsi_lun = 0; } } fclose(proc_scsi); -- cgit v1.2.3