Memory leak in ASIHTTPRequest.m + (NSString *)defaultUserAgentString #214

Open
deem0n opened this Issue Jun 23, 2011 · 3 comments

Projects

None yet

4 participants

@deem0n
deem0n commented Jun 23, 2011

easy to fix though:

diff --git a/Classes/ASIHTTPRequest.m b/Classes/ASIHTTPRequest.m
index 7c4f56f..2de5c88 100644
--- a/Classes/ASIHTTPRequest.m
+++ b/Classes/ASIHTTPRequest.m
@@ -4413,7 +4413,8 @@ static NSOperationQueue *sharedQueue = nil;
                        #endif
 
                        // Takes the form "My Application 1.0 (Macintosh; Mac OS X 10.5.7; en_GB)"
-                       [self setDefaultUserAgentString:[NSString stringWithFormat:@"%@ %@ (%@; %@ %@; %@)", appName, appV
+                       [self setDefaultUserAgentString:[NSString stringWithFormat:@"%@ %@ (%@; %@ %@; %@)", appName, appV
+            [appName release];
                }
                return [[defaultUserAgent retain] autorelease];
        }
@ZuYuanZhou

Yes. I find the leak also.

@pokeb
Owner
pokeb commented Aug 6, 2011

Maybe I'm missing something, but I can't see why appName should leak. Each of the instances where it is set give us an autoreleased string. I don't know if it used to leak and this was fixed a while ago, but as far as I can see it shouldn't now.

@bengotow

Me either... this code looks fine. What versions of ASIHTTPRequest does this apply to?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment