diff --git a/Sources/LLVM/Module.swift b/Sources/LLVM/Module.swift index 0487dd2..719ae37 100644 --- a/Sources/LLVM/Module.swift +++ b/Sources/LLVM/Module.swift @@ -292,7 +292,7 @@ extension Module { path.withCString { cString in let mutable = strdup(cString) LLVMPrintModuleToFile(llvm, mutable, &err) - free(mutable) + free(mutable!) } if let err = err { defer { LLVMDisposeMessage(err) } @@ -325,7 +325,7 @@ extension Module { public func emitBitCode(to path: String) throws { let status = path.withCString { cString -> Int32 in let mutable = strdup(cString) - defer { free(mutable) } + defer { free(mutable!) } return LLVMWriteBitcodeToFile(llvm, mutable) } diff --git a/Sources/LLVM/TargetMachine.swift b/Sources/LLVM/TargetMachine.swift index 6c6995c..3aefce9 100644 --- a/Sources/LLVM/TargetMachine.swift +++ b/Sources/LLVM/TargetMachine.swift @@ -239,7 +239,7 @@ public class TargetMachine { var err: UnsafeMutablePointer? let status = path.withCString { cStr -> LLVMBool in let mutable = strdup(cStr) - defer { free(mutable) } + defer { free(mutable!) } return LLVMTargetMachineEmitToFile(llvm, module.llvm, mutable, type.asLLVM(), &err) } if let err = err, status != 0 {