Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

fixed a handful of memory leaks

  • Loading branch information...
commit 7aad400abaa3de8be1378f5465aaa26dee0fc1bc 1 parent 24ef832
Adam Duke authored January 23, 2011
17  OAMutableURLRequest.m
@@ -53,7 +53,7 @@ - (id)initWithURL:(NSURL *)aUrl
53 53
     if (aToken == nil) {
54 54
         token = [[OAToken alloc] init];
55 55
     } else {
56  
-        token = aToken;
  56
+        token = [aToken retain];
57 57
     }
58 58
     
59 59
     if (aRealm == nil) {
@@ -127,13 +127,17 @@ - (void)prepare {
127 127
 }
128 128
 
129 129
 - (void)_generateTimestamp {
130  
-    timestamp = [[NSString stringWithFormat:@"%d", time(NULL)] retain];
  130
+	[timestamp release];
  131
+    timestamp = [[NSString alloc]initWithFormat:@"%d", time(NULL)];
131 132
 }
132 133
 
133 134
 - (void)_generateNonce {
134 135
     CFUUIDRef theUUID = CFUUIDCreate(NULL);
135 136
     CFStringRef string = CFUUIDCreateString(NULL, theUUID);
136 137
     CFRelease(theUUID);
  138
+	if (nonce) {
  139
+		CFRelease(nonce);
  140
+	}
137 141
     nonce = (NSString *)string;
138 142
 }
139 143
 
@@ -173,4 +177,13 @@ - (NSString *)_signatureBaseString {
173 177
             [normalizedRequestParameters encodedURLString]];
174 178
 }
175 179
 
  180
+- (void) dealloc
  181
+{
  182
+	[token release];
  183
+	[(NSObject*)signatureProvider release];
  184
+	[timestamp release];
  185
+	CFRelease(nonce);
  186
+	[super dealloc];
  187
+}
  188
+
176 189
 @end
5  OARequestParameter.m
@@ -69,4 +69,9 @@ + (id)requestParameter:(NSString *)aName value:(NSString *)aValue
69 69
 	return [[[self alloc] initWithName:aName value:aValue] autorelease];
70 70
 }
71 71
 
  72
+- (void)dealloc{
  73
+	[name release];
  74
+	[value release];
  75
+	[super dealloc];
  76
+}
72 77
 @end
6  OAToken.m
@@ -190,7 +190,11 @@ - (NSDictionary *)attributes {
190 190
 
191 191
 - (void)setAttributes:(NSDictionary *)theAttributes {
192 192
 	[attributes release];
193  
-	attributes = [[NSMutableDictionary alloc] initWithDictionary:theAttributes];
  193
+	if (theAttributes) {
  194
+		attributes = [[NSMutableDictionary alloc] initWithDictionary:theAttributes];
  195
+	}else {
  196
+		attributes = nil;
  197
+	}
194 198
 }
195 199
 
196 200
 - (BOOL)hasAttributes {

0 notes on commit 7aad400

Please sign in to comment.
Something went wrong with that request. Please try again.