Fixed 2 memory leaks so Bruce doesn't have to

This commit is contained in:
tague%netscape.com 1999-04-07 03:55:34 +00:00
Родитель 5eaa0c1389
Коммит af15e24c5c
3 изменённых файлов: 13 добавлений и 1 удалений

Просмотреть файл

@ -110,6 +110,13 @@ nsLocaleFactory::NewLocale(const nsString* localeName, nsILocale** locale)
NS_ASSERTION(newLocale!=NULL,"nsLocaleFactory: failed to create nsLocale");
newLocale->AddRef();
//
// delete temporary strings
//
for(i=0;i<6;i++)
delete valueList[i];
delete [] valueList;
*locale = (nsILocale*)newLocale;
return NS_OK;

Просмотреть файл

@ -259,6 +259,7 @@ nsIWin32LocaleImpl::GetPlatformLocale(const nsString* locale,LCID* winLCID)
if (!ParseLocaleString(locale_string,language_code,country_code,region_code)) {
*winLCID = MAKELCID(MAKELANGID(USER_DEFINED_PRIMARYLANG,USER_DEFINED_SUBLANGUAGE),
SORT_DEFAULT);
delete [] locale_string;
return NS_OK;
}
// we have a LL-CC-RR style string
@ -270,6 +271,7 @@ nsIWin32LocaleImpl::GetPlatformLocale(const nsString* locale,LCID* winLCID)
//
*winLCID = MAKELCID(MAKELANGID(USER_DEFINED_PRIMARYLANG,USER_DEFINED_SUBLANGUAGE),
SORT_DEFAULT);
delete [] locale_string;
return NS_OK;
}
@ -279,6 +281,7 @@ nsIWin32LocaleImpl::GetPlatformLocale(const nsString* locale,LCID* winLCID)
//
*winLCID = MAKELCID(MAKELANGID(winLangCode,SUBLANG_DEFAULT),
SORT_DEFAULT);
delete [] locale_string;
return NS_OK;
}
@ -289,10 +292,12 @@ nsIWin32LocaleImpl::GetPlatformLocale(const nsString* locale,LCID* winLCID)
//
*winLCID = MAKELCID(MAKELANGID(winLangCode,USER_DEFINED_SUBLANGUAGE),
SORT_DEFAULT);
delete [] locale_string;
return NS_OK;
}
*winLCID = winLangCode | winSublangCode;
delete [] locale_string;
return NS_OK;
}

Просмотреть файл

@ -167,7 +167,7 @@ factory_new_locale(void)
delete catagory;
delete value;
}
delete localeName;
locale->Release();
catagoryList = new nsString*[6];