We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e99b969 commit c577fdaCopy full SHA for c577fda
Foundation/URLSession/http/HTTPBodySource.swift
@@ -130,13 +130,15 @@ extension _HTTPBodyStreamSource: _HTTPBodySource {
130
}
131
let readBytes = self.inputStream.read(pointer, maxLength: length)
132
if readBytes > 0 {
133
- let dispatchData = DispatchData(bytes: UnsafeRawBufferPointer(buffer))
+ let dispatchData = DispatchData(bytesNoCopy: UnsafeRawBufferPointer(buffer), deallocator: .free)
134
return .data(dispatchData.subdata(in: 0 ..< readBytes))
135
136
else if readBytes == 0 {
137
+ buffer.deallocate()
138
return .done
139
140
else {
141
142
return .error
143
144
0 commit comments