Differences From Artifact [f4fafd457a]:
- File src/OFObject+KeyValueCoding.m — part of check-in [10fbb20fd6] at 2016-06-05 16:00:07 on branch trunk — Key Value Coding: Add fallback to isFoo (user: js, size: 5601) [annotate] [blame] [check-ins using]
To Artifact [6d4c66aa16]:
- File
src/OFObject+KeyValueCoding.m
— part of check-in
[49ed0fa5ec]
at
2016-06-05 16:04:11
on branch trunk
— Key Value Coding: Make sure free is always called
In theory, if -[UTF8String] would throw, this could leak. (user: js, size: 5664) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
55 56 57 58 59 60 61 | if ((keyLength = [key UTF8StringLength]) < 1) return [self valueForUndefinedKey: key]; if ((name = malloc(keyLength + 3)) == NULL) @throw [OFOutOfMemoryException exceptionWithRequestedSize: keyLength + 3]; | > | | | | | | | > | 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | if ((keyLength = [key UTF8StringLength]) < 1) return [self valueForUndefinedKey: key]; if ((name = malloc(keyLength + 3)) == NULL) @throw [OFOutOfMemoryException exceptionWithRequestedSize: keyLength + 3]; @try { memcpy(name, "is", 2); memcpy(name + 2, [key UTF8String], keyLength); name[keyLength + 2] = '\0'; name[2] = toupper(name[2]); selector = sel_registerName(name); } @finally { free(name); } typeEncoding = [self typeEncodingForSelector: selector]; if (typeEncoding == NULL || *typeEncoding == '@' || *typeEncoding == '#') return [self valueForUndefinedKey: key]; } |
︙ | ︙ | |||
135 136 137 138 139 140 141 | return; } if ((name = malloc(keyLength + 5)) == NULL) @throw [OFOutOfMemoryException exceptionWithRequestedSize: keyLength + 5]; | > | | | | | | | > | 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | return; } if ((name = malloc(keyLength + 5)) == NULL) @throw [OFOutOfMemoryException exceptionWithRequestedSize: keyLength + 5]; @try { memcpy(name, "set", 3); memcpy(name + 3, [key UTF8String], keyLength); memcpy(name + keyLength + 3, ":", 2); name[3] = toupper(name[3]); selector = sel_registerName(name); } @finally { free(name); } typeEncoding = [self typeEncodingForSelector: selector]; if (typeEncoding == NULL || nextType(&typeEncoding) != 'v' || nextType(&typeEncoding) != '@' || nextType(&typeEncoding) != ':') { [self setValue: value forUndefinedKey: key]; |
︙ | ︙ |