Fix leak of image data in CGImageGetDataProvider#1710
Conversation
| woc::unique_cf<CFDataRef> data{ CFDataCreateWithBytesNoCopy(nullptr, pPtr, length, kCFAllocatorNull) }; | ||
| CGDataProviderRef dataProvider = CGDataProviderCreateWithCFData(data.get()); | ||
|
|
||
| //TODO 1709:: Autorelease dataProvider so it won't leak for consumers expecting a non-owning reference |
There was a problem hiding this comment.
Wrong issue number here. Why the TODO, why not add this to autorelease pool with this fix?
There was a problem hiding this comment.
The issue number is correct. Adding to the autorelease pool was causing the failures I made #1709 for.
There was a problem hiding this comment.
Okay, so this is a caller released object that was extra released.
There was a problem hiding this comment.
the actual fix is postponed till the merge?, is it too much work to actually fix the ImageIO test rather than introducing intentional bugs to satisfy bad test code?
There was a problem hiding this comment.
It's already been fixed on CGD2D, If it was a complex change I didn't want to have it done twice.
| (unsigned char*)[imageByteData bytes], | ||
| &inputImage); | ||
| [imageByteData release]; | ||
| CGDataProviderRelease(provider); |
There was a problem hiding this comment.
CGDataProviderRelease [](start = 4, length = 21)
Thanks! :D
CGImageGetDataProvider was copying the CFData rather than accessing it directly, and would leak the data for consumers expecting a +0 reference.
Blocks #1692
This change is