File tree Expand file tree Collapse file tree 3 files changed +30
-15
lines changed
stdlib/private/StdlibUnittest Expand file tree Collapse file tree 3 files changed +30
-15
lines changed Original file line number Diff line number Diff line change 18
18
SWIFT_CC (swift) SWIFT_RUNTIME_LIBRARY_VISIBILITY extern "C"
19
19
const char *
20
20
getSystemVersionPlistProperty(const char *PropertyName) {
21
- // This function is implemented in Objective-C because Swift does not support
22
- // failing initializers.
23
- if (!PropertyName)
24
- return nullptr ;
21
+ @autoreleasepool {
22
+ // This function is implemented in Objective-C because Swift does not support
23
+ // failing initializers.
24
+ if (!PropertyName)
25
+ return nullptr ;
25
26
26
- NSDictionary *SystemVersion =
27
- [NSDictionary dictionaryWithContentsOfFile:
28
- @" /System/Library/CoreServices/SystemVersion.plist" ];
29
- if (!SystemVersion)
30
- return nullptr ;
31
- NSString *PropertyNameString = [NSString stringWithUTF8String: PropertyName];
32
- const char *Result = strdup ([SystemVersion[PropertyNameString] UTF8String ]);
33
- [PropertyNameString release ];
34
- [SystemVersion release ];
35
- return Result;
27
+ NSDictionary *SystemVersion =
28
+ [NSDictionary dictionaryWithContentsOfFile:
29
+ @" /System/Library/CoreServices/SystemVersion.plist" ];
30
+ if (!SystemVersion)
31
+ return nullptr ;
32
+ NSString *PropertyNameString = [NSString stringWithUTF8String: PropertyName];
33
+ const char *Result = strdup ([SystemVersion[PropertyNameString] UTF8String ]);
34
+ return Result;
35
+ }
36
36
}
37
37
#endif
38
38
Original file line number Diff line number Diff line change @@ -1718,7 +1718,9 @@ func _getSystemVersionPlistPropertyImpl(
1718
1718
1719
1719
func _getSystemVersionPlistProperty( _ propertyName: String ) -> String ? {
1720
1720
let cs = _getSystemVersionPlistPropertyImpl ( propertyName)
1721
- return cs. map ( String . init ( cString: ) )
1721
+ let str = cs. map ( String . init ( cString: ) )
1722
+ free ( UnsafeMutableRawPointer ( mutating: cs) )
1723
+ return str
1722
1724
}
1723
1725
#endif
1724
1726
Original file line number Diff line number Diff line change
1
+ // RUN: %target-run-simple-swift
2
+ // REQUIRES: executable_test
3
+
4
+ import Foundation
5
+ import StdlibUnittest
6
+
7
+ var Suite = TestSuite ( " Overrelease " )
8
+
9
+ Suite . test ( " doesntfail " ) . xfail ( . never) . code { }
10
+
11
+ autoreleasepool {
12
+ runAllTests ( )
13
+ }
You can’t perform that action at this time.
0 commit comments