Skip to content

Commit f503537

Browse files
committed
CoreFoundation: correct an over-release in CFTimeZone
We would release a value obtained through a `CFDictionaryGetValue` which would result in the value being over-released as the returned object is returned at `+0`. This fixes the use-after-free on Windows. Thanks to Gwynne Raskind for identifying the mismanagement of the retain counts!
1 parent 3cd1f79 commit f503537

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

CoreFoundation/NumberDate.subproj/CFTimeZone.c

-2
Original file line numberDiff line numberDiff line change
@@ -1125,7 +1125,6 @@ Boolean _CFTimeZoneInit(CFTimeZoneRef timeZone, CFStringRef name, CFDataRef data
11251125
if (tzName) {
11261126
int32_t offset;
11271127
__CFTimeZoneGetOffset(tzName, &offset);
1128-
CFRelease(tzName);
11291128
// TODO(compnerd) handle DST
11301129
__CFTimeZoneInitFixed(timeZone, offset, name, 0);
11311130
return TRUE;
@@ -1328,7 +1327,6 @@ CFTimeZoneRef CFTimeZoneCreateWithName(CFAllocatorRef allocator, CFStringRef nam
13281327
if (tzName) {
13291328
int32_t offset;
13301329
__CFTimeZoneGetOffset(tzName, &offset);
1331-
CFRelease(tzName);
13321330
// TODO(compnerd) handle DST
13331331
result = __CFTimeZoneCreateFixed(allocator, offset, name, 0);
13341332
}

0 commit comments

Comments
 (0)