Fixed two more failures to report and handle errors, found by the Clang Static Analyzer.
authorPeter Hosey <hg@boredzo.org>
Sat Oct 10 12:33:16 2009 -0700 (2009-10-10)
changeset 4509714a3c623b46
parent 4508 ebe7f0a2ff4d
child 4510 1a0499744fd3
Fixed two more failures to report and handle errors, found by the Clang Static Analyzer.
Extras/HardwareGrowler/USBNotifier.c
     1.1 --- a/Extras/HardwareGrowler/USBNotifier.c	Sat Oct 10 12:26:06 2009 -0700
     1.2 +++ b/Extras/HardwareGrowler/USBNotifier.c	Sat Oct 10 12:33:16 2009 -0700
     1.3 @@ -26,6 +26,10 @@
     1.4  			//	This works with USB devices...
     1.5  			//	but apparently not firewire
     1.6  			nameResult = IORegistryEntryGetName(thisObject, deviceNameChars);
     1.7 +			if (nameResult != KERN_SUCCESS) {
     1.8 +				NSLog(CFSTR("%s: Could not get name for USB object %p: IORegistryEntryGetName returned 0x%x"), __PRETTY_FUNCTION__, thisObject, nameResult);
     1.9 +				continue;
    1.10 +			}
    1.11  
    1.12  			CFStringRef deviceName = CFStringCreateWithCString(kCFAllocatorDefault,
    1.13  															   deviceNameChars,
    1.14 @@ -59,6 +63,11 @@
    1.15  		//	This works with USB devices...
    1.16  		//	but apparently not firewire
    1.17  		nameResult = IORegistryEntryGetName(thisObject, deviceNameChars);
    1.18 +		if (nameResult != KERN_SUCCESS) {
    1.19 +			NSLog(CFSTR("%s: Could not get name for USB object %p: IORegistryEntryGetName returned 0x%x"), __PRETTY_FUNCTION__, thisObject, nameResult);
    1.20 +			continue;
    1.21 +		}
    1.22 +
    1.23  		CFStringRef deviceName = CFStringCreateWithCString(kCFAllocatorDefault,
    1.24  														   deviceNameChars,
    1.25  														   kCFStringEncodingASCII);