Skip to content

Commit 970da0e

Browse files
committed
CFKnownLocations // Release username when should.
1 parent 56a4e3f commit 970da0e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Sources/CoreFoundation/CFKnownLocations.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ CFURLRef _Nullable _CFKnownLocationCreatePreferencesURLForUser(CFKnownLocationUs
9999
username = CFGetUserName();
100100
// The above API returns a non-NULL CFStringRef. The failed result is an empty string.
101101
// We need to check for that case and fall through to the next case.
102-
if (!CFEqual(username, CFSTR(""))) {
102+
Boolean isEmpty = CFEqual(username, CFSTR(""));
103+
CFRelease(username);
104+
if (!isEmpty) {
103105
break;
104106
}
105107
// fallthrough.

0 commit comments

Comments
 (0)