We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f98fc84 commit e66fd1aCopy full SHA for e66fd1a
stdlib/public/runtime/Casting.cpp
@@ -1973,7 +1973,11 @@ static id dynamicCastValueToNSError(OpaqueValue *src,
1973
1974
BoxPair errorBox = swift_allocError(srcType, srcErrorWitness, src,
1975
/*isTake*/ flags & DynamicCastFlags::TakeOnSuccess);
1976
- return _swift_stdlib_bridgeErrorToNSError((SwiftError*)errorBox.object);
+ auto *error = (SwiftError *)errorBox.object;
1977
+ id result = _swift_stdlib_bridgeErrorToNSError(error);
1978
+ // Now that we have bridged the error to nserror, release the error.
1979
+ SWIFT_CC_PLUSZERO_GUARD(swift_errorRelease(error));
1980
+ return result;
1981
}
1982
1983
#endif
0 commit comments