| File: | Plugins/Facebook Service/AIFacebookStatusManager.m |
| Location: | line 27, column 2 |
| Description: | Memory Leak |
| Code is compiled without garbage collection. |
| 1 | // |
| 2 | // AIFacebookStatusManager.m |
| 3 | // Adium |
| 4 | // |
| 5 | // Created by Evan Schoenberg on 5/12/08. |
| 6 | // |
| 7 | |
| 8 | #import "AIFacebookStatusManager.h" |
| 9 | #import "AIFacebookAccount.h" |
| 10 | |
| 11 | @implementation AIFacebookStatusManager |
| 12 | |
| 13 | + (void)setFacebookStatusMessage:(NSString *)statusMessage forAccount:(AIFacebookAccount *)account |
| 14 | { |
| 15 | NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://www.facebook.com/updatestatus.php"] |
| 16 | cachePolicy:NSURLRequestUseProtocolCachePolicy |
| 17 | timeoutInterval:120]; |
| 18 | NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys: |
| 19 | [account postFormID], @"post_form_id", |
| 20 | statusMessage, @"status", |
| 21 | nil0]; |
| 22 | NSData *postData = [AIFacebookAccount postDataForDictionary:dict]; |
| 23 | [request setHTTPMethod:@"POST"]; |
| 24 | [request setValue:[NSString stringWithFormat:@"%d", [postData length]] forHTTPHeaderField:@"Content-Length"]; |
| 25 | [request setHTTPBody:postData]; |
| 26 | |
[1] Method returns an object with a +1 retain count (owning reference). | |
[2] Object allocated on line 27 is no longer referenced after this point and has a retain count of +1 (object leaked). | |
| 27 | [[NSURLConnection alloc] initWithRequest:request delegate:self]; |
| 28 | } |
| 29 | |
| 30 | + (void)connection:(NSURLConnection *)inConnection didReceiveResponse:(NSURLResponse *)response |
| 31 | { |
| 32 | //This can be called multiple times, for example in the case of a redirect, so each time we reset the data. |
| 33 | } |
| 34 | |
| 35 | + (void)connection:(NSURLConnection *)inConnection didReceiveData:(NSData *)data |
| 36 | { |
| 37 | NSMutableString *receivedString = [[NSMutableString alloc] initWithData:data encoding:NSUTF8StringEncoding]; |
| 38 | AILogWithSignatureAILogWithPrefix ( __PRETTY_FUNCTION__ , @ "Received %@" , receivedString ) ;(@"Received %@", receivedString); |
| 39 | [receivedString release]; |
| 40 | } |
| 41 | |
| 42 | + (void)connectionDidFinishLoading:(NSURLConnection *)inConnection |
| 43 | { |
| 44 | [inConnection release]; |
| 45 | } |
| 46 | |
| 47 | @end |