[ad_1]
Fortify’s Static Code Analyzer flagged out a excessive threat vulnerability – “Unreleased Useful resource: Streams” on Alamofire in iOS (Swift) cell app venture.
Abstract
The operate lambda { (inout DataStreamRequest.StreamMutableState) ->; Void? }() in Request.swift typically fails to launch a system useful resource allotted by open() on line 1377.The recognized operate typically fails to launch a system useful resource.
Clarification
This system can probably fail to launch a system useful resource.On this case, there are program paths on which the useful resource allotted in Request.swift on line 1377 is just not launched.”
public func asInputStream(bufferSize: Int = 1024) -> InputStream? {
defer { resume() }
var inputStream: InputStream?
$streamMutableState.write { state in
Basis.Stream.getBoundStreams(withBufferSize: bufferSize,
inputStream: &inputStream,
outputStream: &state.outputStream)
state.outputStream?.open()
}
return inputStream
}
I made reference to related subject -> Unreleased Useful resource: Streams #3146 which was marked as False Optimistic with defer { shut() }.
Nevertheless, there isn’t any defer { shut() } on this subject flagged by Fortify.
Any recommendation on the way to resolve this?
[ad_2]
