mopub/mopub-client — Issue #30: Memory Leak in [MPAdConversionTracker reportApplicationOpenSynchronous:]
Author: aleph7
Created: 2012-02-09 18:05:02+00:00
State: open

There are two return statements within the method which don't release the autorelease pool. Here is the patch:

```
diff --git a/MoPubiOS/MoPubSDK/MPAdConversionTracker.m b/MoPubiOS/MoPubSDK/MPAdConversionTracker.m
index c7e8771..c59bfb7 100644
--- a/MoPubiOS/MoPubSDK/MPAdConversionTracker.m
+++ b/MoPubiOS/MoPubSDK/MPAdConversionTracker.m
@@ -52,14 +52,20 @@
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
-	if ([paths count] <= 0) return;
+	if ([paths count] <= 0) {
+	[pool release];
+	return;
+	}

NSString *documentsDir = [paths objectAtIndex:0];
NSString *appOpenLogPath = [documentsDir stringByAppendingPathComponent:@"mopubAppOpen.log"];
NSFileManager *fileManager = [NSFileManager defaultManager];

// The existence of mopubAppOpen.log tells us whether we have already reported this app open.
-	if ([fileManager fileExistsAtPath:appOpenLogPath]) return;
+	if ([fileManager fileExistsAtPath:appOpenLogPath]) {
+	[pool release];
+	return;
+	}

NSString *appID = [context objectForKey:kApplicationIdContextKey];
NSString *userAgent = [context objectForKey:kUserAgentContextKey];
```