From 084d57cef4dfdac8fa122ee4da8b15996aacdc2b Mon Sep 17 00:00:00 2001 From: Dominik Riebeling Date: Sun, 19 Dec 2010 21:21:28 +0000 Subject: 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 --- rbutil/ipodpatcher/ipodio-posix.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'rbutil/ipodpatcher') 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, /* set value to match. In case of the Ipod this is "iPodUserClientDevice". */ CFMutableDictionaryRef sub_dict; sub_dict = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, NULL, NULL); + if(sub_dict == NULL) + return -1; CFDictionarySetValue(sub_dict, CFSTR(kIOPropertySCSITaskDeviceCategory), CFSTR("iPodUserClientDevice")); CFDictionarySetValue(match_dict, CFSTR(kIOPropertyMatchKey), sub_dict); - if(sub_dict == NULL) - return -1; - /* get an iterator for searching for the service. */ kern_return_t kr; io_iterator_t iterator = IO_OBJECT_NULL; -- cgit