diff --git a/native_client/swift/stt_ios/STT.swift b/native_client/swift/stt_ios/STT.swift index b1705f22..214e5ad2 100644 --- a/native_client/swift/stt_ios/STT.swift +++ b/native_client/swift/stt_ios/STT.swift @@ -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) } }