cocoafob icon indicating copy to clipboard operation
cocoafob copied to clipboard

Memory Leak in CFobLicVerifier?

Open AppTyrant opened this issue 8 years ago • 2 comments

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.

AppTyrant avatar Mar 17 '16 19:03 AppTyrant

I'll need to investigate, thanks for reporting

glebd avatar Mar 19 '16 00:03 glebd

@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.

R4N avatar Jun 14 '17 17:06 R4N