Skip to content

Commit 0d67182

Browse files
authored
Merge pull request #850 from ahoppen/data-leak
Fix a memory leak in `DispatchData.withUnsafeBytes`
2 parents e85f6a0 + ee9c2b1 commit 0d67182

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/swift/Data.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public struct DispatchData : RandomAccessCollection {
110110
{
111111
var ptr: UnsafeRawPointer? = nil
112112
var size = 0
113-
let data = CDispatch.dispatch_data_create_map(__wrapped.__wrapped, &ptr, &size)
113+
let data = DispatchData(data: CDispatch.dispatch_data_create_map(__wrapped.__wrapped, &ptr, &size))
114114
let contentPtr = ptr!.bindMemory(
115115
to: ContentType.self, capacity: size / MemoryLayout<ContentType>.stride)
116116
defer { _fixLifetime(data) }

0 commit comments

Comments
 (0)