# HG changeset patch # User Jens Alfke # Date 1240940188 25200 # Node ID 59689fbdcf772dbf23f9e1c5cd7cc596af3e8703 # Parent 732576fa8a0d3ee58ab4572e1f12345ba03fc3fe Fixed two CF memory leaks. (Fixes issue #5) diff -r 732576fa8a0d -r 59689fbdcf77 BLIP/BLIPTest.m --- a/BLIP/BLIPTest.m Mon Apr 27 09:03:56 2009 -0700 +++ b/BLIP/BLIPTest.m Tue Apr 28 10:36:28 2009 -0700 @@ -52,6 +52,7 @@ SecIdentityRef identity; while (SecIdentitySearchCopyNext(search, &identity) == noErr) [identities addObject: (id)identity]; + CFRelease(search); Log(@"Found %u identities -- prompting '%@'", identities.count, prompt); if (identities.count > 0) { SFChooseIdentityPanel *panel = [SFChooseIdentityPanel sharedChooseIdentityPanel]; diff -r 732576fa8a0d -r 59689fbdcf77 TCP/TCPConnection.m --- a/TCP/TCPConnection.m Mon Apr 27 09:03:56 2009 -0700 +++ b/TCP/TCPConnection.m Tue Apr 28 10:36:28 2009 -0700 @@ -111,14 +111,16 @@ CFWriteStreamRef writeStream = NULL; CFStreamCreatePairWithSocket(kCFAllocatorDefault, socket, &readStream, &writeStream); self = [self _initWithAddress: [IPAddress addressOfSocket: socket] - inputStream: (NSInputStream*)readStream - outputStream: (NSOutputStream*)writeStream]; + inputStream: (NSInputStream*)CFMakeCollectable(readStream) + outputStream: (NSOutputStream*)CFMakeCollectable(writeStream)]; if( self ) { _isIncoming = YES; _server = [listener retain]; CFReadStreamSetProperty(readStream, kCFStreamPropertyShouldCloseNativeSocket, kCFBooleanTrue); CFWriteStreamSetProperty(writeStream, kCFStreamPropertyShouldCloseNativeSocket, kCFBooleanTrue); } + if(readStream) CFRelease(readStream); + if(writeStream) CFRelease(writeStream); return self; }