diff --git a/Reachability.m b/Reachability.m index 4c1c94a..d95f361 100644 --- a/Reachability.m +++ b/Reachability.m @@ -100,6 +100,8 @@ +(instancetype)reachabilityWithHostname:(NSString*)hostname { id reachability = [[self alloc] initWithReachabilityRef:ref]; + CFRelease(ref); + return reachability; } @@ -112,7 +114,9 @@ +(instancetype)reachabilityWithAddress:(void *)hostAddress if (ref) { id reachability = [[self alloc] initWithReachabilityRef:ref]; - + + CFRelease(ref); + return reachability; } @@ -152,6 +156,8 @@ -(instancetype)initWithReachabilityRef:(SCNetworkReachabilityRef)ref self.reachableOnWWAN = YES; self.reachabilityRef = ref; + CFRetain(self.reachabilityRef); + // We need to create a serial queue. // We allocate this once for the lifetime of the notifier.