Core/Source/GrowlPreferencesController.m
changeset 4261 48b7c994f6c8
parent 4246 4f52d1d98978
child 4270 5c1d8f5e64c2
     1.1 --- a/Core/Source/GrowlPreferencesController.m	Tue Jul 07 11:42:50 2009 -0400
     1.2 +++ b/Core/Source/GrowlPreferencesController.m	Sat Aug 01 20:50:32 2009 -0400
     1.3 @@ -90,6 +90,8 @@
     1.4  
     1.5  - (id) objectForKey:(NSString *)key {
     1.6  	id value = (id)CFPreferencesCopyAppValue((CFStringRef)key, (CFStringRef)GROWL_HELPERAPP_BUNDLE_IDENTIFIER);
     1.7 +	if(value)
     1.8 +		CFMakeCollectable(value);
     1.9  	return [value autorelease];
    1.10  }
    1.11  
    1.12 @@ -259,10 +261,12 @@
    1.13  
    1.14  	while (GetNextProcess(&PSN) == noErr) {
    1.15  		NSDictionary *infoDict = (NSDictionary *)ProcessInformationCopyDictionary(&PSN, kProcessDictionaryIncludeAllInformationMask);
    1.16 -		NSString *bundleID = [infoDict objectForKey:(NSString *)kCFBundleIdentifierKey];
    1.17 -		isRunning = bundleID && [bundleID isEqualToString:theBundleIdentifier];
    1.18 -		[infoDict release];
    1.19 -
    1.20 +		if(infoDict) {
    1.21 +			NSString *bundleID = [infoDict objectForKey:(NSString *)kCFBundleIdentifierKey];
    1.22 +			isRunning = bundleID && [bundleID isEqualToString:theBundleIdentifier];
    1.23 +			CFMakeCollectable(infoDict);
    1.24 +			[infoDict release];
    1.25 +		}
    1.26  		if (isRunning)
    1.27  			break;
    1.28  	}
    1.29 @@ -401,8 +405,11 @@
    1.30  	NSString *passwordString;
    1.31  	if (status == noErr) {
    1.32  		passwordString = (NSString *)CFStringCreateWithBytes(kCFAllocatorDefault, password, passwordLength, kCFStringEncodingUTF8, false);
    1.33 -		[passwordString autorelease];
    1.34 -		SecKeychainItemFreeContent(NULL, password);
    1.35 +		if(passwordString) {
    1.36 +			CFMakeCollectable(passwordString);
    1.37 +			[passwordString autorelease];
    1.38 +			SecKeychainItemFreeContent(NULL, password);
    1.39 +		}
    1.40  	} else {
    1.41  		if (status != errSecItemNotFound)
    1.42  			NSLog(@"Failed to retrieve password from keychain. Error: %d", status);