From 8de25b9b7f0658c6295c14ad0f9dc7499db6a9f3 Mon Sep 17 00:00:00 2001 From: "dbaron%dbaron.org" Date: Tue, 28 Jan 2003 01:42:56 +0000 Subject: [PATCH] Fix leak in AutoRegisterComponent. b=189811 r=dougt sr=bzbarsky a=asa --- xpcom/components/nsComponentManager.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xpcom/components/nsComponentManager.cpp b/xpcom/components/nsComponentManager.cpp index 4cd8fd180650..f71cc40d5bc3 100644 --- a/xpcom/components/nsComponentManager.cpp +++ b/xpcom/components/nsComponentManager.cpp @@ -3128,9 +3128,12 @@ nsComponentManagerImpl::AutoRegisterComponent(PRInt32 when, for (int i = 0; i < mNLoaderData; i++) { PRBool didRegister; if (!mLoaderData[i].loader) { - rv = GetLoaderForType(i, &mLoaderData[i].loader); + nsCOMPtr loader; + rv = GetLoaderForType(i, getter_AddRefs(loader)); if (NS_FAILED(rv)) continue; + // |GetLoaderForType| has filled in |mLoaderData[i].loader|: + NS_ASSERTION(loader == mLoaderData[i].loader, "oops"); } rv = mLoaderData[i].loader->AutoRegisterComponent((int)when, component, &didRegister); if (NS_SUCCEEDED(rv) && didRegister)