Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

Commit

Permalink
Fix stream leak in SDPDYStreamManager.
Browse files Browse the repository at this point in the history
  • Loading branch information
kgoodier committed May 28, 2015
1 parent 56d571f commit 5f9354a
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
2 changes: 1 addition & 1 deletion SPDY/SPDYStreamManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ @implementation SPDYStreamNode
{
@public
__strong SPDYStreamNode *next;
__strong SPDYStreamNode *prev;
__weak SPDYStreamNode *prev;
__strong SPDYStream *stream;
__unsafe_unretained SPDYProtocol *protocol;
SPDYStreamId streamId;
Expand Down
38 changes: 38 additions & 0 deletions SPDYUnitTests/SPDYStreamManagerTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,42 @@ - (void)testStreamRemoval
STAssertEquals(streamCount, _numStreams - 2, nil);
}

- (void)testStreamRemovalDoesNotLeak
{
SPDYStream __weak *weakone;
@autoreleasepool {
weakone = _manager[4];
STAssertNotNil(weakone, nil);
[_manager removeStreamWithStreamId:4];
STAssertNil(_manager[4], nil);
}
STAssertNil(weakone, nil);
}

- (void)testAllStreamRemovalDoesNotLeak
{
SPDYStream __weak *weakone;
@autoreleasepool {
weakone = _manager[4];
STAssertNotNil(weakone, nil);
[_manager removeAllStreams];
STAssertNil(_manager[4], nil);
}
STAssertNil(weakone, nil);
}

- (void)testDeallocDoesNotLeak
{
SPDYStreamManager __weak *weakmanager;
SPDYStream __weak *weakone;
@autoreleasepool {
weakmanager = _manager;
weakone = _manager[4];
STAssertNotNil(weakone, nil);
_manager = nil;
}
STAssertNil(weakmanager, nil);
STAssertNil(weakone, nil);
}

@end

0 comments on commit 5f9354a

Please sign in to comment.