bug 108539, r=jag, sr=sfraser, need to call NS_IF_RELEASE(mInner) to prevent leak of datasource, also cleaned up create instance call

This commit is contained in:
pchen%netscape.com 2001-11-06 01:20:12 +00:00
Родитель 09750f9a69
Коммит 8a4edf9b41
1 изменённых файлов: 5 добавлений и 4 удалений

Просмотреть файл

@ -4138,10 +4138,11 @@ nsBookmarksService::initDatasource()
// the profile manager might call Readbookmarks() in certain circumstances
// so we need to forget about any previous bookmarks
mInner = nsnull;
if (NS_FAILED(rv = nsComponentManager::CreateInstance(kRDFInMemoryDataSourceCID,
nsnull, NS_GET_IID(nsIRDFDataSource), (void**) &mInner)))
return(rv);
NS_IF_RELEASE(mInner);
rv = CallCreateInstance(kRDFInMemoryDataSourceCID, &mInner);
if (NS_FAILED(rv))
return rv;
rv = mInner->AddObserver(this);
if (NS_FAILED(rv)) return rv;