From ac58cab7938695f8ecdaf0dace9b1c89fbc10aaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Renella?= Date: Tue, 13 Oct 2015 16:28:28 +0200 Subject: [PATCH] Fix Product > Analyze errors on Xcode7 Fix potential leaks reported by Xcode7 --- Reachability.m | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Reachability.m b/Reachability.m index 4c1c94a..3bef65b 100644 --- a/Reachability.m +++ b/Reachability.m @@ -99,6 +99,7 @@ +(instancetype)reachabilityWithHostname:(NSString*)hostname if (ref) { id reachability = [[self alloc] initWithReachabilityRef:ref]; + CFRelease(ref); return reachability; } @@ -112,7 +113,8 @@ +(instancetype)reachabilityWithAddress:(void *)hostAddress if (ref) { id reachability = [[self alloc] initWithReachabilityRef:ref]; - + CFRelease(ref); + return reachability; } @@ -151,6 +153,7 @@ -(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.