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
-1
View File
@@ -41,7 +41,6 @@
[wagicDownloadController performSelectorInBackground: @selector(startDownload:) withObject:@"core"]; [wagicDownloadController performSelectorInBackground: @selector(startDownload:) withObject:@"core"];
[self.window addSubview: wagicDownloadController.view]; [self.window addSubview: wagicDownloadController.view];
[wagicDownloadController.view release];
[self.window makeKeyWindow]; [self.window makeKeyWindow];
} }
+5 -3
View File
@@ -362,13 +362,14 @@ SYNTHESIZE_SINGLETON_FOR_CLASS(SoundManager);
NSMutableArray *playlistTracks = [musicPlaylists objectForKey:aPlaylistName]; NSMutableArray *playlistTracks = [musicPlaylists objectForKey:aPlaylistName];
if (!playlistTracks) { if (!playlistTracks) {
playlistTracks = [[NSMutableArray alloc] init]; playlistTracks = [NSMutableArray arrayWithCapacity: 1];
} }
[playlistTracks addObject:aTrackName]; [playlistTracks addObject:aTrackName];
// Add the track key to the play list // Add the track key to the play list
[musicPlaylists setObject:playlistTracks forKey:aPlaylistName]; [musicPlaylists setObject:playlistTracks forKey:aPlaylistName];
} }
- (void)startPlaylistNamed:(NSString*)aPlaylistName { - (void)startPlaylistNamed:(NSString*)aPlaylistName {
@@ -391,13 +392,14 @@ SYNTHESIZE_SINGLETON_FOR_CLASS(SoundManager);
NSMutableArray *playlistTracks = [musicPlaylists objectForKey:aPlaylistName]; NSMutableArray *playlistTracks = [musicPlaylists objectForKey:aPlaylistName];
if (playlistTracks) { if (playlistTracks) {
int indexToRemove; int indexToRemove = -1;
for (int index=0; index < [currentPlaylistTracks count]; index++) { for (NSUInteger index=0; index < [currentPlaylistTracks count]; index++) {
if ([[currentPlaylistTracks objectAtIndex:index] isEqualToString:aTrackName]) { if ([[currentPlaylistTracks objectAtIndex:index] isEqualToString:aTrackName]) {
indexToRemove = index; indexToRemove = index;
break; break;
} }
} }
if (indexToRemove >= 0)
[currentPlaylistTracks removeObjectAtIndex:indexToRemove]; [currentPlaylistTracks removeObjectAtIndex:indexToRemove];
} }
} }
@@ -1156,7 +1156,7 @@ static NSOperationQueue *sharedQueue = nil;
// Create the stream for the request // Create the stream for the request
// //
NSFileManager *fileManager = [[[NSFileManager alloc] init] autorelease]; NSFileManager *fileManager = [NSFileManager defaultManager];
[self setReadStreamIsScheduled:NO]; [self setReadStreamIsScheduled:NO];
@@ -1214,6 +1214,7 @@ static NSOperationQueue *sharedQueue = nil;
CFReadStreamSetProperty((CFReadStreamRef)[self readStream], CFReadStreamSetProperty((CFReadStreamRef)[self readStream],
kCFStreamPropertySSLSettings, kCFStreamPropertySSLSettings,
(CFTypeRef)sslProperties); (CFTypeRef)sslProperties);
[sslProperties release];
} }
// Tell CFNetwork to use a client certificate // Tell CFNetwork to use a client certificate