Skip to content
This repository

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

Open
deem0n opened this Issue · 3 comments

4 participants

deem0n ZY Ben Copsey Ben Gotow
deem0n
deem0n commented

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];
        }
ZY

Yes. I find the leak also.

Ben Copsey
Owner

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.

Ben Gotow

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
Something went wrong with that request. Please try again.