Modified: trunk/Source/WebCore/ChangeLog (217488 => 217489)
--- trunk/Source/WebCore/ChangeLog 2017-05-26 13:28:51 UTC (rev 217488)
+++ trunk/Source/WebCore/ChangeLog 2017-05-26 14:36:40 UTC (rev 217489)
@@ -1,3 +1,15 @@
+2017-05-26 Youenn Fablet <[email protected]>
+
+ Fix memory leaks in MediaSampleAVFObjC::create
+ https://bugs.webkit.org/show_bug.cgi?id=172600
+
+ Reviewed by Eric Carlson.
+
+ No change of behavior.
+
+ * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:
+ (WebCore::MediaSampleAVFObjC::createImageSample):
+
2017-05-26 Manuel Rego Casasnovas <[email protected]>
[css-grid] Add support for orthogonal positioned grid items
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm (217488 => 217489)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm 2017-05-26 13:28:51 UTC (rev 217488)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm 2017-05-26 14:36:40 UTC (rev 217489)
@@ -43,8 +43,9 @@
RefPtr<MediaSampleAVFObjC> MediaSampleAVFObjC::createImageSample(Vector<uint8_t>&& array, unsigned long width, unsigned long height)
{
- CVPixelBufferRef imageBuffer = nullptr;
- auto status = CVPixelBufferCreateWithBytes(kCFAllocatorDefault, width, height, kCVPixelFormatType_32BGRA, array.data(), width * 4, releaseUint8Vector, array.releaseBuffer().leakPtr(), NULL, &imageBuffer);
+ CVPixelBufferRef pixelBuffer = nullptr;
+ auto status = CVPixelBufferCreateWithBytes(kCFAllocatorDefault, width, height, kCVPixelFormatType_32BGRA, array.data(), width * 4, releaseUint8Vector, array.releaseBuffer().leakPtr(), NULL, &pixelBuffer);
+ auto imageBuffer = adoptCF(pixelBuffer);
ASSERT_UNUSED(status, !status);
if (!imageBuffer)
@@ -51,21 +52,24 @@
return nullptr;
CMVideoFormatDescriptionRef formatDescription = nullptr;
- status = CMVideoFormatDescriptionCreateForImageBuffer(kCFAllocatorDefault, imageBuffer, &formatDescription);
+ status = CMVideoFormatDescriptionCreateForImageBuffer(kCFAllocatorDefault, imageBuffer.get(), &formatDescription);
ASSERT(!status);
CMSampleTimingInfo sampleTimingInformation = { kCMTimeInvalid, kCMTimeInvalid, kCMTimeInvalid };
- CMSampleBufferRef sample;
- status = CMSampleBufferCreateReadyWithImageBuffer(kCFAllocatorDefault, imageBuffer, formatDescription, &sampleTimingInformation, &sample);
+ CMSampleBufferRef sampleBuffer;
+ status = CMSampleBufferCreateReadyWithImageBuffer(kCFAllocatorDefault, imageBuffer.get(), formatDescription, &sampleTimingInformation, &sampleBuffer);
+ CFRelease(formatDescription);
ASSERT(!status);
- CFArrayRef attachmentsArray = CMSampleBufferGetSampleAttachmentsArray(sample, true);
+ auto sample = adoptCF(sampleBuffer);
+
+ CFArrayRef attachmentsArray = CMSampleBufferGetSampleAttachmentsArray(sample.get(), true);
for (CFIndex i = 0; i < CFArrayGetCount(attachmentsArray); ++i) {
CFMutableDictionaryRef attachments = (CFMutableDictionaryRef)CFArrayGetValueAtIndex(attachmentsArray, i);
CFDictionarySetValue(attachments, kCMSampleAttachmentKey_DisplayImmediately, kCFBooleanTrue);
}
- return create(sample);
+ return create(sample.get());
}
MediaTime MediaSampleAVFObjC::presentationTime() const