Skip to content

Commit 4d46ec4

Browse files
Dev: deallocate buffer in _HTTPBodyStreamSource
1 parent c520710 commit 4d46ec4

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

Foundation/URLSession/URLSessionTask.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ extension _ProtocolClient: URLProtocolClient {
650650
}
651651
}
652652
}
653-
default: return
653+
default: return
654654
}
655655
}
656656

Foundation/URLSession/http/HTTPBodySource.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ extension _HTTPBodyStreamSource: _HTTPBodySource {
126126
if inputStream.hasBytesAvailable {
127127
let buffer = UnsafeMutableRawBufferPointer.allocate(count: length)
128128
guard let pointer = buffer.baseAddress?.assumingMemoryBound(to: UInt8.self) else {
129+
buffer.deallocate()
129130
return .error
130131
}
131132
let readBytes = self.inputStream.read(pointer, maxLength: length)

0 commit comments

Comments
 (0)