Differences From Artifact [e268178a8e]:
- File src/OFData.m — part of check-in [4d5b2623c8] at 2020-11-04 23:11:54 on branch trunk — OFData: Fix memory leak (user: js, size: 14765) [annotate] [blame] [check-ins using]
To Artifact [8ada741898]:
- File
src/OFData.m
— part of check-in
[3d8286feee]
at
2020-11-04 23:18:25
on branch trunk
— Remove of_free()
While it makes sense to wrap malloc and calloc to replace the error
checking with exceptions, it does not make sense to wrap free. (user: js, size: 14753) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
203 204 205 206 207 208 209 | @try { [file readIntoBuffer: buffer exactLength: (size_t)size]; } @finally { [file release]; } } @catch (id e) { | | | | 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | @try { [file readIntoBuffer: buffer exactLength: (size_t)size]; } @finally { [file release]; } } @catch (id e) { free(buffer); [self release]; @throw e; } @try { self = [self initWithItemsNoCopy: buffer count: (size_t)size freeWhenDone: true]; } @catch (id e) { free(buffer); @throw e; } return self; } #endif |
︙ | ︙ | |||
262 263 264 265 266 267 268 | _items = [self resizeMemory: _items size: _count + length]; memcpy(_items + _count, buffer, length); _count += length; } } @finally { | | | 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | _items = [self resizeMemory: _items size: _count + length]; memcpy(_items + _count, buffer, length); _count += length; } } @finally { free(buffer); } objc_autoreleasePoolPop(pool); } @catch (id e) { [self release]; @throw e; } |
︙ | ︙ | |||
382 383 384 385 386 387 388 | return self; } - (void)dealloc { if (_freeWhenDone) | | | 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 | return self; } - (void)dealloc { if (_freeWhenDone) free(_items); [_parentData release]; [super dealloc]; } - (size_t)count |
︙ | ︙ |