Bug 342750 NativeUConvService::GetNativeConverter leaks on failure

p=Ryan Jones <bugs@ryan-jones.com>, r=bsmedberg, sr=dbaron
This commit is contained in:
asqueella%gmail.com 2007-01-17 09:18:21 +00:00
parent a3f2b3c15b
commit 35d1685d44

View File

@ -372,15 +372,13 @@ NativeUConvService::GetNativeConverter(const char* from,
{
*aResult = nsnull;
IConvAdaptor* ucl = new IConvAdaptor();
nsRefPtr<IConvAdaptor> ucl = new IConvAdaptor();
if (!ucl)
return NS_ERROR_OUT_OF_MEMORY;
nsresult rv = ucl->Init(from, to);
if (NS_SUCCEEDED(rv)) {
NS_ADDREF(*aResult = (nsISupports*)(nsIUnicharEncoder*)ucl);
}
if (NS_SUCCEEDED(rv))
NS_ADDREF(*aResult = ucl);
return rv;
}