Check if creating the dictionary worked before accessing it, not afterwards.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28860 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Dominik Riebeling 2010-12-19 21:21:28 +00:00
parent ee3fc61a48
commit 084d57cef4

View file

@ -167,13 +167,12 @@ int ipod_scsi_inquiry(struct ipod_t* ipod, int page_code,
/* set value to match. In case of the Ipod this is "iPodUserClientDevice". */ /* set value to match. In case of the Ipod this is "iPodUserClientDevice". */
CFMutableDictionaryRef sub_dict; CFMutableDictionaryRef sub_dict;
sub_dict = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, NULL, NULL); sub_dict = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, NULL, NULL);
if(sub_dict == NULL)
return -1;
CFDictionarySetValue(sub_dict, CFSTR(kIOPropertySCSITaskDeviceCategory), CFDictionarySetValue(sub_dict, CFSTR(kIOPropertySCSITaskDeviceCategory),
CFSTR("iPodUserClientDevice")); CFSTR("iPodUserClientDevice"));
CFDictionarySetValue(match_dict, CFSTR(kIOPropertyMatchKey), sub_dict); CFDictionarySetValue(match_dict, CFSTR(kIOPropertyMatchKey), sub_dict);
if(sub_dict == NULL)
return -1;
/* get an iterator for searching for the service. */ /* get an iterator for searching for the service. */
kern_return_t kr; kern_return_t kr;
io_iterator_t iterator = IO_OBJECT_NULL; io_iterator_t iterator = IO_OBJECT_NULL;