Swift 5.5/Xcode 13 imports Darwin.free() as taking a non-optional pointer

Is this intentional? Is this a bug? The BSD free(3) function is fine with receiving a NULL pointer so I cannot understand why the change.

Furthermore it seems like this will cause a lot of crashes as a lot of C pointer types are imported as implicitly unwrapped optionals, passing those to free() when they are nil will now crash, when it didn't before.

I've filed this as SR-15197. My expectation is that this is a bug.


I asked @John_McCall on twitter and he said it is a known bug.

1 Like

This should be also blocking SwiftFoundation builds because free() is used here and there.
But, CI seems not to fail due to it recently.
I wonder why.

CI is not building with the latest Xcode 13 that has this particular change. The Xcode 13 betas did not have it.

1 Like
Terms of Service

Privacy Policy

Cookie Policy