Fixed 2 memory leaks so Bruce doesn't have to

git-svn-id: svn://10.0.0.236/trunk@26677 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
tague%netscape.com 1999-04-07 03:55:34 +00:00
parent 8a19907163
commit d2b766343c
3 changed files with 13 additions and 1 deletions

View File

@ -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;

View File

@ -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;
}

View File

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