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

Fix leak warning from Xcode's static analyzer. #165

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions Reachability.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF

@interface Reachability ()

@property (nonatomic, assign) SCNetworkReachabilityRef reachabilityRef;
@property (nonatomic, strong) __attribute__((NSObject)) SCNetworkReachabilityRef reachabilityRef;
@property (nonatomic, strong) dispatch_queue_t reachabilitySerialQueue;
@property (nonatomic, strong) id reachabilityObject;

Expand Down Expand Up @@ -99,6 +99,7 @@ +(instancetype)reachabilityWithHostname:(NSString*)hostname
if (ref)
{
id reachability = [[self alloc] initWithReachabilityRef:ref];
CFRelease(ref);

return reachability;
}
Expand All @@ -112,6 +113,7 @@ +(instancetype)reachabilityWithAddress:(void *)hostAddress
if (ref)
{
id reachability = [[self alloc] initWithReachabilityRef:ref];
CFRelease(ref);

return reachability;
}
Expand Down Expand Up @@ -165,12 +167,7 @@ -(void)dealloc
{
[self stopNotifier];

if(self.reachabilityRef)
{
CFRelease(self.reachabilityRef);
self.reachabilityRef = nil;
}

self.reachabilityRef = nil;
self.reachableBlock = nil;
self.unreachableBlock = nil;
self.reachabilityBlock = nil;
Expand Down