diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2010-12-19 21:21:28 +0000 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2010-12-19 21:21:28 +0000 |
commit | 084d57cef4dfdac8fa122ee4da8b15996aacdc2b (patch) | |
tree | e7bda3a20c713fb846e174f648eca175e9cc6603 | |
parent | ee3fc61a48975c90b72cc4089b4f0e47495c1345 (diff) | |
download | rockbox-084d57cef4dfdac8fa122ee4da8b15996aacdc2b.tar.gz rockbox-084d57cef4dfdac8fa122ee4da8b15996aacdc2b.zip |
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
-rw-r--r-- | rbutil/ipodpatcher/ipodio-posix.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/rbutil/ipodpatcher/ipodio-posix.c b/rbutil/ipodpatcher/ipodio-posix.c index 881c09b54f..db8648e70e 100644 --- a/rbutil/ipodpatcher/ipodio-posix.c +++ b/rbutil/ipodpatcher/ipodio-posix.c | |||
@@ -167,13 +167,12 @@ int ipod_scsi_inquiry(struct ipod_t* ipod, int page_code, | |||
167 | /* set value to match. In case of the Ipod this is "iPodUserClientDevice". */ | 167 | /* set value to match. In case of the Ipod this is "iPodUserClientDevice". */ |
168 | CFMutableDictionaryRef sub_dict; | 168 | CFMutableDictionaryRef sub_dict; |
169 | sub_dict = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, NULL, NULL); | 169 | sub_dict = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, NULL, NULL); |
170 | if(sub_dict == NULL) | ||
171 | return -1; | ||
170 | CFDictionarySetValue(sub_dict, CFSTR(kIOPropertySCSITaskDeviceCategory), | 172 | CFDictionarySetValue(sub_dict, CFSTR(kIOPropertySCSITaskDeviceCategory), |
171 | CFSTR("iPodUserClientDevice")); | 173 | CFSTR("iPodUserClientDevice")); |
172 | CFDictionarySetValue(match_dict, CFSTR(kIOPropertyMatchKey), sub_dict); | 174 | CFDictionarySetValue(match_dict, CFSTR(kIOPropertyMatchKey), sub_dict); |
173 | 175 | ||
174 | if(sub_dict == NULL) | ||
175 | return -1; | ||
176 | |||
177 | /* get an iterator for searching for the service. */ | 176 | /* get an iterator for searching for the service. */ |
178 | kern_return_t kr; | 177 | kern_return_t kr; |
179 | io_iterator_t iterator = IO_OBJECT_NULL; | 178 | io_iterator_t iterator = IO_OBJECT_NULL; |