Skip to content
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

Memory Leak in CFobLicVerifier? #22

Open
AppTyrant opened this issue Mar 17, 2016 · 2 comments
Open

Memory Leak in CFobLicVerifier? #22

AppTyrant opened this issue Mar 17, 2016 · 2 comments

Comments

@AppTyrant
Copy link

I think there may be a memory leak in CFobLicVerifier when compiled with ARC (I'm running Xcode 7.2.1/ OS X 10.11.3).

@property (retain) __attribute__((NSObject)) SecKeyRef publicKey;

If I take that out, set the publicKey ivar directly and retain it (and release it when I'm done) that seemed to get rid of the leak.

@glebd
Copy link
Owner

glebd commented Mar 19, 2016

I'll need to investigate, thanks for reporting

@R4N
Copy link

R4N commented Jun 14, 2017

@AppTyrant @glebd

I noticed this as well while profiling.

In addition to the purposed adjustment from AppTyrant, another possible solution would be to add an else condition with CFobLicVerifier Lifecycle portion and CFRelease(_publicKey) when compiled with ARC:

#pragma mark -
#pragma mark Lifecycle

#if !__has_feature(objc_arc)
- (void)finalize
{
	self.publicKey = nil;
	[super finalize];
}

- (void)dealloc
{
	self.publicKey = nil;
	self.blacklist = nil;
	[super dealloc];
}
#else
- (void)dealloc
{
    CFRelease(_publicKey);
}
#endif

Let me know if you'd like me to issue a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants