fixed some memory leaks found in the analyzer

This commit is contained in:
techdragon.nguyen@gmail.com
2012-02-16 06:49:31 +00:00
parent 719fb41dc2
commit 2e65fe02fe
3 changed files with 8 additions and 6 deletions

View File

@@ -362,13 +362,14 @@ SYNTHESIZE_SINGLETON_FOR_CLASS(SoundManager);
NSMutableArray *playlistTracks = [musicPlaylists objectForKey:aPlaylistName];
if (!playlistTracks) {
playlistTracks = [[NSMutableArray alloc] init];
playlistTracks = [NSMutableArray arrayWithCapacity: 1];
}
[playlistTracks addObject:aTrackName];
// Add the track key to the play list
[musicPlaylists setObject:playlistTracks forKey:aPlaylistName];
}
- (void)startPlaylistNamed:(NSString*)aPlaylistName {
@@ -391,14 +392,15 @@ SYNTHESIZE_SINGLETON_FOR_CLASS(SoundManager);
NSMutableArray *playlistTracks = [musicPlaylists objectForKey:aPlaylistName];
if (playlistTracks) {
int indexToRemove;
for (int index=0; index < [currentPlaylistTracks count]; index++) {
int indexToRemove = -1;
for (NSUInteger index=0; index < [currentPlaylistTracks count]; index++) {
if ([[currentPlaylistTracks objectAtIndex:index] isEqualToString:aTrackName]) {
indexToRemove = index;
break;
}
}
[currentPlaylistTracks removeObjectAtIndex:indexToRemove];
if (indexToRemove >= 0)
[currentPlaylistTracks removeObjectAtIndex:indexToRemove];
}
}

View File

@@ -1156,7 +1156,7 @@ static NSOperationQueue *sharedQueue = nil;
// Create the stream for the request
//
NSFileManager *fileManager = [[[NSFileManager alloc] init] autorelease];
NSFileManager *fileManager = [NSFileManager defaultManager];
[self setReadStreamIsScheduled:NO];
@@ -1214,6 +1214,7 @@ static NSOperationQueue *sharedQueue = nil;
CFReadStreamSetProperty((CFReadStreamRef)[self readStream],
kCFStreamPropertySSLSettings,
(CFTypeRef)sslProperties);
[sslProperties release];
}
// Tell CFNetwork to use a client certificate