Misc leaks fixes.

CQTexperiment
vspader 2009-09-01 21:14:07 -07:00
parent 50326dfed8
commit 288c5cbee5
11 changed files with 25 additions and 17 deletions

View File

@ -266,6 +266,7 @@
{ {
if (nextStream == nil) if (nextStream == nil)
{ {
[newChain release];
return YES; return YES;
} }

View File

@ -137,7 +137,7 @@ addressForHost(NSString *hostname)
} }
buffer[bytesRead] = '\0'; buffer[bytesRead] = '\0';
result = [[[NSString alloc] autorelease] initWithUTF8String:buffer]; result = [[[NSString alloc] initWithUTF8String:buffer] autorelease];
} while(keepGoing); } while(keepGoing);

View File

@ -28,6 +28,7 @@
ContainedNode *node = [[ContainedNode alloc] initWithDataSource:dataSource url:u]; ContainedNode *node = [[ContainedNode alloc] initWithDataSource:dataSource url:u];
NSLog(@"Node: %@", u); NSLog(@"Node: %@", u);
[paths addObject:node]; [paths addObject:node];
[node release];
} }
[self setSubpaths:paths]; [self setSubpaths:paths];

View File

@ -72,7 +72,7 @@ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMA
- (NSString *) ellipsizeAfterNWords: (int) n { - (NSString *) ellipsizeAfterNWords: (int) n {
NSArray *stringComponents = [self componentsSeparatedByString: @" "]; NSArray *stringComponents = [self componentsSeparatedByString: @" "];
NSMutableArray *componentsCopy = [stringComponents mutableCopy]; NSMutableArray *componentsCopy = [[stringComponents mutableCopy] autorelease];
int ix = n; int ix = n;
int len = [componentsCopy count]; int len = [componentsCopy count];

View File

@ -110,8 +110,11 @@ int ao_get_lib(char *fn, uint8 **buf, uint64 *length)
NSString *key = [[NSString alloc] initWithUTF8String:info.title[i]]; NSString *key = [[NSString alloc] initWithUTF8String:info.title[i]];
NSString *value = [[NSString alloc] initWithUTF8String:info.info[i]]; NSString *value = [[NSString alloc] initWithUTF8String:info.info[i]];
if (nil == key || nil == value) if (nil == key || nil == value) {
[key release];
[value release];
continue; continue;
}
if ([key hasPrefix:@"Name"]) { if ([key hasPrefix:@"Name"]) {
[dict setObject:value forKey:@"title"]; [dict setObject:value forKey:@"title"];
@ -335,6 +338,7 @@ int ao_get_lib(char *fn, uint8 **buf, uint64 *length)
AODecoder *decoder = [[self alloc] init]; AODecoder *decoder = [[self alloc] init];
if (![decoder openUnderLock:source]) { if (![decoder openUnderLock:source]) {
[decoder release];
[globalLock unlock]; [globalLock unlock];
return nil; return nil;
} }

View File

@ -208,6 +208,7 @@
// Send it off! // Send it off!
NSInteger sent = [_socket send:requestBytes amount:requestLength]; NSInteger sent = [_socket send:requestBytes amount:requestLength];
if (sent != requestLength) { if (sent != requestLength) {
[requestString release];
return NO; return NO;
} }
NSLog(@"Sent:\n%@\n", requestString); NSLog(@"Sent:\n%@\n", requestString);

View File

@ -12,7 +12,7 @@
+ (NSArray *)preferencePanes + (NSArray *)preferencePanes
{ {
GeneralPreferencesPlugin *plugin = [[GeneralPreferencesPlugin alloc] init]; GeneralPreferencesPlugin *plugin = [[[GeneralPreferencesPlugin alloc] init] autorelease];
[NSBundle loadNibNamed:@"Preferences" owner:plugin]; [NSBundle loadNibNamed:@"Preferences" owner:plugin];
return [NSArray arrayWithObjects: return [NSArray arrayWithObjects:

View File

@ -26,6 +26,7 @@
// Set which panes are included, and their order. // Set which panes are included, and their order.
//[prefs setPanesOrder:[NSArray arrayWithObjects:@"General", @"Updating", @"A Non-Existent Preference Pane", nil]]; //[prefs setPanesOrder:[NSArray arrayWithObjects:@"General", @"Updating", @"A Non-Existent Preference Pane", nil]];
[pluginController release];
} }
// Show the preferences window. // Show the preferences window.

View File

@ -61,16 +61,16 @@ static NSPredicate * musicOnlyPredicate = nil;
self.query = [[[NSMetadataQuery alloc]init]autorelease]; self.query = [[[NSMetadataQuery alloc]init]autorelease];
[self.query setDelegate:self]; [self.query setDelegate:self];
self.query.sortDescriptors = [NSArray arrayWithObjects: self.query.sortDescriptors = [NSArray arrayWithObjects:
[[NSSortDescriptor alloc]initWithKey:@"kMDItemAuthors" [[[NSSortDescriptor alloc]initWithKey:@"kMDItemAuthors"
ascending:YES ascending:YES
selector:@selector(compareFirstString:)], selector:@selector(compareFirstString:)] autorelease],
[[NSSortDescriptor alloc]initWithKey:@"kMDItemAlbum" [[[NSSortDescriptor alloc]initWithKey:@"kMDItemAlbum"
ascending:YES ascending:YES
selector:@selector(caseInsensitiveCompare:)], selector:@selector(caseInsensitiveCompare:)] autorelease],
[[NSSortDescriptor alloc]initWithKey:@"kMDItemAudioTrackNumber" [[[NSSortDescriptor alloc]initWithKey:@"kMDItemAudioTrackNumber"
ascending:YES ascending:YES
selector:@selector(compareTrackNumbers:)], selector:@selector(compareTrackNumbers:)] autorelease],
nil]; nil];
// hook my query transformer up to me // hook my query transformer up to me
[PausingQueryTransformer setSearchController:self]; [PausingQueryTransformer setSearchController:self];

View File

@ -33,7 +33,7 @@
// unlike the usual case, this is returned retained (by self, effectively). The one-shot releases // unlike the usual case, this is returned retained (by self, effectively). The one-shot releases
// itself when it's complete // itself when it's complete
return ft; return [ft autorelease];
} }

View File

@ -52,8 +52,8 @@ static NSString *TrackingSliderValueObservationContext = @"TrackingSliderValueOb
NSDictionary *bindingsData = [NSDictionary dictionaryWithObjectsAndKeys: NSDictionary *bindingsData = [NSDictionary dictionaryWithObjectsAndKeys:
observableController, NSObservedObjectKey, observableController, NSObservedObjectKey,
[keyPath copy], NSObservedKeyPathKey, [[keyPath copy] autorelease], NSObservedKeyPathKey,
[options copy], NSOptionsKey, nil]; [[options copy] autorelease], NSOptionsKey, nil];
[bindingInfo setObject:bindingsData forKey:binding]; [bindingInfo setObject:bindingsData forKey:binding];
} }