Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #28 from pivotaltracker/master

Fixed memory leaks in expectations and matchers
  • Loading branch information...
commit abc3d83283fdc3942413e2f3603be6dbb2fe44b8 2 parents d50b919 + 53259b9
@petejkim petejkim authored
View
10 src/EXPBlockDefinedMatcher.m
@@ -10,6 +10,16 @@
@implementation EXPBlockDefinedMatcher
+- (void)dealloc
+{
+ self.prerequisiteBlock = nil;
+ self.matchBlock = nil;
+ self.failureMessageForToBlock = nil;
+ self.failureMessageForNotToBlock = nil;
+
+ [super dealloc];
+}
+
@synthesize prerequisiteBlock;
@synthesize matchBlock;
@synthesize failureMessageForToBlock;
View
10 src/EXPExpect.m
@@ -37,6 +37,12 @@ - (id)initWithActualBlock:(id)actualBlock testCase:(id)testCase lineNumber:(int)
return self;
}
+- (void)dealloc
+{
+ self.actualBlock = nil;
+ [super dealloc];
+}
+
+ (EXPExpect *)expectWithActualBlock:(id)actualBlock testCase:(id)testCase lineNumber:(int)lineNumber fileName:(char *)fileName {
return [[[EXPExpect alloc] initWithActualBlock:actualBlock testCase:(id)testCase lineNumber:lineNumber fileName:fileName] autorelease];
}
@@ -186,9 +192,9 @@ - (NSString *)failureMessageForNotTo:(id)actual
{
__block id blockExpectation = _expectation;
- return [^{
+ return [[^{
[blockExpectation applyMatcher:self];
- } copy];
+ } copy] autorelease];
}
@end
View
1  src/ExpectaSupport.h
@@ -42,6 +42,7 @@ EXPFixCategoriesBug(EXPMatcher##matcherName##Matcher); \
} \
[self applyMatcher:matcher to:&actual]; \
}; \
+ [matcher release]; \
return [[matcherBlock copy] autorelease]; \
} \
@end
Please sign in to comment.
Something went wrong with that request. Please try again.