Skip to content

Commit f5247f4

Browse files
committed
Add free() workaround that causes error when built with some compiler versions.
Otherwise some building compilers will see errors: ``` error: value of optional type 'UnsafeMutablePointer<CChar>?' (aka 'Optional<UnsafeMutablePointer<Int8>>') must be unwrapped to a value of type 'UnsafeMutablePointer<CChar>' (aka 'UnsafeMutablePointer<Int8>') for ptr in cstrings { free(ptr) } ```
1 parent 2f2a3f8 commit f5247f4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Sources/SwiftDriver/SwiftScan/SwiftScan.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,5 +360,5 @@ func withArrayOfCStrings(_ strings: [String],
360360
let _ = unsafeCStrings.withUnsafeBufferPointer {
361361
action(UnsafeMutablePointer(mutating: $0.baseAddress))
362362
}
363-
for ptr in cstrings { free(ptr) }
363+
for ptr in cstrings { if let ptr = ptr { free(ptr) } }
364364
}

0 commit comments

Comments
 (0)