-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix memory leak in function CFTimeZoneCreateWithName #2816
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -1594,6 +1594,7 @@ CFTimeZoneRef CFTimeZoneCreateWithName(CFAllocatorRef allocator, CFStringRef nam | |||
#endif | |||
CFRelease(dict); | |||
if (CFEqual(CFSTR(""), name)) { | |||
CFRelease(baseURL); | |||
return NULL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is a CFRelease(data);
also needed for the assignment on L1574?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data
is released on L1617.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant if the return NULL
on L1598 is reached then data
wont have been released?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right - there's codepath where data
is allocated.
And also there's code path where baseURL
isn't allocated.
So I fixed both.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah good, catch. Could you revert the indentation commit since we want to avoid changing unrelated lines and then squash this all down to one commit, thanks. I think it should be ok then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@swift-ci please test |
e837b67
to
2a1cbf1
Compare
2a1cbf1
to
a493212
Compare
@swift-ci test |
@swift-ci please test |
ping |
1 similar comment
ping |
No description provided.