fixed duplicate deallocation of stream

streamCtx must be unset after STT_FreeStream was called in STT_FinishStreamWithMetadata, else STT_FreeStream is called again on destruction of STTStream resulting in EXC_BAD_ACCESS errors
This commit is contained in:
Leon Kiefer 2021-09-26 12:56:28 +02:00 committed by GitHub
parent 5691d4e053
commit fab1bbad73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -283,7 +283,10 @@ public class STTStream {
precondition(streamCtx != nil, "calling method on invalidated Stream")
let result = STT_FinishStreamWithMetadata(streamCtx, UInt32(numResults))!
defer { STT_FreeMetadata(result) }
defer {
STT_FreeMetadata(result)
streamCtx = nil
}
return STTMetadata(fromInternal: result)
}
}