fixed leaked service manager in nsPluginFactory

git-svn-id: svn://10.0.0.236/trunk@48362 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
warren%netscape.com
1999-09-20 20:53:06 +00:00
parent f923450bcf
commit 24085aaebf
2 changed files with 10 additions and 12 deletions

View File

@@ -18,7 +18,7 @@
#include "nscore.h"
#include "nsIFactory.h"
#include "nsISupports.h"
#include "nsCOMPtr.h"
//#include "nsPluginsCID.h"
#include "nsPluginHostImpl.h"
@@ -158,12 +158,11 @@ NSGetFactory(nsISupports* serviceMgr,
return NS_ERROR_NULL_POINTER;
}
nsIServiceManager *pnsIServiceManager = NULL;
if (NS_FAILED(serviceMgr->QueryInterface(kIServiceManagerIID, (void**) &pnsIServiceManager)))
return NS_ERROR_FAILURE;
nsresult rv;
nsCOMPtr<nsIServiceManager> servMgr = do_QueryInterface(serviceMgr, &rv);
if (NS_FAILED(rv)) return rv;
*aFactory = new nsPluginFactory(aClass, pnsIServiceManager);
serviceMgr->Release();
*aFactory = new nsPluginFactory(aClass, servMgr);
if (nsnull == aFactory) {
return NS_ERROR_OUT_OF_MEMORY;

View File

@@ -18,7 +18,7 @@
#include "nscore.h"
#include "nsIFactory.h"
#include "nsISupports.h"
#include "nsCOMPtr.h"
//#include "nsPluginsCID.h"
#include "nsPluginHostImpl.h"
@@ -158,12 +158,11 @@ NSGetFactory(nsISupports* serviceMgr,
return NS_ERROR_NULL_POINTER;
}
nsIServiceManager *pnsIServiceManager = NULL;
if (NS_FAILED(serviceMgr->QueryInterface(kIServiceManagerIID, (void**) &pnsIServiceManager)))
return NS_ERROR_FAILURE;
nsresult rv;
nsCOMPtr<nsIServiceManager> servMgr = do_QueryInterface(serviceMgr, &rv);
if (NS_FAILED(rv)) return rv;
*aFactory = new nsPluginFactory(aClass, pnsIServiceManager);
serviceMgr->Release();
*aFactory = new nsPluginFactory(aClass, servMgr);
if (nsnull == aFactory) {
return NS_ERROR_OUT_OF_MEMORY;