diff --git a/src/swift/Data.swift b/src/swift/Data.swift index 158ec1fe6..ac962d71c 100644 --- a/src/swift/Data.swift +++ b/src/swift/Data.swift @@ -110,7 +110,7 @@ public struct DispatchData : RandomAccessCollection { { var ptr: UnsafeRawPointer? = nil var size = 0 - let data = CDispatch.dispatch_data_create_map(__wrapped.__wrapped, &ptr, &size) + let data = DispatchData(data: CDispatch.dispatch_data_create_map(__wrapped.__wrapped, &ptr, &size)) let contentPtr = ptr!.bindMemory( to: ContentType.self, capacity: size / MemoryLayout.stride) defer { _fixLifetime(data) }