fix for bug 9853

git-svn-id: svn://10.0.0.236/trunk@41637 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
neeti%netscape.com 1999-07-30 23:56:51 +00:00
parent 140839a521
commit ac4091c162

View File

@ -1164,12 +1164,17 @@ extern "C" NS_EXPORT nsresult NSGetFactory(
if (aClass.Equals(kPrefCID))
{
nsresult res = NS_OK;
nsPrefFactory *factory = new nsPrefFactory();
nsresult res = factory->QueryInterface(kFactoryIID, (void **) aFactory);
if (NS_FAILED(res))
{
*aFactory = NULL;
delete factory;
if (factory) {
res = factory->QueryInterface(kFactoryIID, (void **) aFactory);
if (NS_FAILED(res))
{
*aFactory = NULL;
delete factory;
}
} else {
res = NS_ERROR_OUT_OF_MEMORY;
}
return res;
}