зеркало из https://github.com/mozilla/gecko-dev.git
fix memory leak, bug=22104, r=rjc, a=chofmann
This commit is contained in:
Родитель
5f2b8736c4
Коммит
6133cf2276
|
@ -302,6 +302,7 @@ cookie_Localize(char* genericString) {
|
|||
printf("cannot get string from name\n");
|
||||
return v.ToNewUnicode();
|
||||
}
|
||||
nsCRT::free(ptrv);
|
||||
return v.ToNewUnicode();
|
||||
}
|
||||
|
||||
|
|
|
@ -668,7 +668,6 @@ Wallet_Localize(char* genericString) {
|
|||
}
|
||||
nsILocale* locale = nsnull;
|
||||
nsIStringBundle* bundle = nsnull;
|
||||
#if 1
|
||||
char* spec = nsnull;
|
||||
ret = url->GetSpec(&spec);
|
||||
if (NS_FAILED(ret)) {
|
||||
|
@ -679,9 +678,6 @@ Wallet_Localize(char* genericString) {
|
|||
}
|
||||
ret = pStringService->CreateBundle(spec, locale, &bundle);
|
||||
nsCRT::free(spec);
|
||||
#else
|
||||
ret = pStringService->CreateBundle(url, locale, &bundle);
|
||||
#endif
|
||||
if (NS_FAILED(ret)) {
|
||||
printf("cannot create instance\n");
|
||||
nsServiceManager::ReleaseService(kStringBundleServiceCID, pStringService);
|
||||
|
@ -690,20 +686,17 @@ Wallet_Localize(char* genericString) {
|
|||
nsServiceManager::ReleaseService(kStringBundleServiceCID, pStringService);
|
||||
|
||||
/* localize the given string */
|
||||
#if 1
|
||||
nsString strtmp(genericString);
|
||||
const PRUnichar *ptrtmp = strtmp.GetUnicode();
|
||||
PRUnichar *ptrv = nsnull;
|
||||
ret = bundle->GetStringFromName(ptrtmp, &ptrv);
|
||||
v = ptrv;
|
||||
#else
|
||||
ret = bundle->GetStringFromName(nsString(genericString), v);
|
||||
#endif
|
||||
NS_RELEASE(bundle);
|
||||
if (NS_FAILED(ret)) {
|
||||
printf("cannot get string from name\n");
|
||||
return v.ToNewUnicode();
|
||||
}
|
||||
v = ptrv;
|
||||
nsCRT::free(ptrv);
|
||||
return v.ToNewUnicode();
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче