Mac installer: eliminate minor memory leaks.

This commit is contained in:
Charlie Fenton 2013-06-18 05:45:16 -07:00
parent 53d28e5faa
commit 71a2a4350d
1 changed files with 16 additions and 0 deletions

View File

@ -295,6 +295,7 @@ void GetPreferredLanguages() {
aLanguage = CFStringCreateWithCString(NULL, "en", kCFStringEncodingMacRoman);
CFArrayAppendValue(supportedLanguages, aLanguage);
CFRelease(aLanguage);
aLanguage = NULL;
dirp = opendir(Catalogs_Dir);
@ -315,6 +316,7 @@ void GetPreferredLanguages() {
// printf("Adding %s to supportedLanguages array\n", dp->d_name);
aLanguage = CFStringCreateWithCString(NULL, dp->d_name, kCFStringEncodingMacRoman);
CFArrayAppendValue(supportedLanguages, aLanguage);
CFRelease(aLanguage);
aLanguage = NULL;
}
@ -356,11 +358,25 @@ void GetPreferredLanguages() {
// further translation is needed for language en.
if (!strcmp(language, "en")) {
fclose(f);
CFRelease(preferredLanguages);
preferredLanguages = NULL;
CFArrayRemoveAllValues(supportedLanguages);
CFRelease(supportedLanguages);
supportedLanguages = NULL;
return;
}
}
CFRelease(preferredLanguages);
preferredLanguages = NULL;
}
fclose(f);
CFArrayRemoveAllValues(supportedLanguages);
CFRelease(supportedLanguages);
supportedLanguages = NULL;
}