From 129e2b3497f83d1fe030797787c87c86888a5d26 Mon Sep 17 00:00:00 2001 From: "dbaron%dbaron.org" Date: Sat, 11 Aug 2007 00:53:53 +0000 Subject: [PATCH] Fix leak in DEBUG-only code. b=391769 r+sr+a=jst git-svn-id: svn://10.0.0.236/trunk@231883 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/js/src/xpconnect/loader/mozJSComponentLoader.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mozilla/js/src/xpconnect/loader/mozJSComponentLoader.cpp b/mozilla/js/src/xpconnect/loader/mozJSComponentLoader.cpp index db937db9819..1dc4ad1131f 100644 --- a/mozilla/js/src/xpconnect/loader/mozJSComponentLoader.cpp +++ b/mozilla/js/src/xpconnect/loader/mozJSComponentLoader.cpp @@ -1315,13 +1315,14 @@ mozJSComponentLoader::Import(const nsACString & registryLocation) NS_ENSURE_SUCCESS(rv, rv); #ifdef DEBUG + { // ensure that we are being call from JS, from this method nsCOMPtr info; rv = cc->GetCalleeInterface(getter_AddRefs(info)); NS_ENSURE_SUCCESS(rv, rv); - char *name; - info->GetName(&name); - NS_ASSERTION(nsCRT::strcmp("nsIXPCComponents_Utils", name) == 0, + nsXPIDLCString name; + info->GetName(getter_Copies(name)); + NS_ASSERTION(nsCRT::strcmp("nsIXPCComponents_Utils", name.get()) == 0, "Components.utils.import must only be called from JS."); PRUint16 methodIndex; const nsXPTMethodInfo *methodInfo; @@ -1331,6 +1332,7 @@ mozJSComponentLoader::Import(const nsACString & registryLocation) rv = cc->GetCalleeMethodIndex(&calleeIndex); NS_ASSERTION(calleeIndex == methodIndex, "Components.utils.import called from another utils method."); + } #endif JSContext *cx = nsnull;