Permalink
Browse files

fixed a handful of memory leaks

  • Loading branch information...
1 parent 24ef832 commit 7aad400abaa3de8be1378f5465aaa26dee0fc1bc @adamvduke adamvduke committed Jan 24, 2011
Showing with 25 additions and 3 deletions.
  1. +15 −2 OAMutableURLRequest.m
  2. +5 −0 OARequestParameter.m
  3. +5 −1 OAToken.m
View
@@ -53,7 +53,7 @@ - (id)initWithURL:(NSURL *)aUrl
if (aToken == nil) {
token = [[OAToken alloc] init];
} else {
- token = aToken;
+ token = [aToken retain];
}
if (aRealm == nil) {
@@ -127,13 +127,17 @@ - (void)prepare {
}
- (void)_generateTimestamp {
- timestamp = [[NSString stringWithFormat:@"%d", time(NULL)] retain];
+ [timestamp release];
+ timestamp = [[NSString alloc]initWithFormat:@"%d", time(NULL)];
}
- (void)_generateNonce {
CFUUIDRef theUUID = CFUUIDCreate(NULL);
CFStringRef string = CFUUIDCreateString(NULL, theUUID);
CFRelease(theUUID);
+ if (nonce) {
+ CFRelease(nonce);
+ }
nonce = (NSString *)string;
}
@@ -173,4 +177,13 @@ - (NSString *)_signatureBaseString {
[normalizedRequestParameters encodedURLString]];
}
+- (void) dealloc
+{
+ [token release];
+ [(NSObject*)signatureProvider release];
+ [timestamp release];
+ CFRelease(nonce);
+ [super dealloc];
+}
+
@end
View
@@ -69,4 +69,9 @@ + (id)requestParameter:(NSString *)aName value:(NSString *)aValue
return [[[self alloc] initWithName:aName value:aValue] autorelease];
}
+- (void)dealloc{
+ [name release];
+ [value release];
+ [super dealloc];
+}
@end
View
@@ -190,7 +190,11 @@ - (NSDictionary *)attributes {
- (void)setAttributes:(NSDictionary *)theAttributes {
[attributes release];
- attributes = [[NSMutableDictionary alloc] initWithDictionary:theAttributes];
+ if (theAttributes) {
+ attributes = [[NSMutableDictionary alloc] initWithDictionary:theAttributes];
+ }else {
+ attributes = nil;
+ }
}
- (BOOL)hasAttributes {

0 comments on commit 7aad400

Please sign in to comment.