partial backout in an attempt to fix orange.
authordwitte@stanford.edu
Fri, 11 Jan 2008 02:08:58 -0800
changeset 10180 194a61f763b22f6741b1a050a556c6a441f598a3
parent 10179 dfd2df0377d549096ccd8dc4b902320d3b8f5f9b
child 10181 ea9487456c74611a6c4e19ba4626c681062ef667
push idunknown
push userunknown
push dateunknown
milestone1.9b3pre
partial backout in an attempt to fix orange.
caps/src/nsNullPrincipal.cpp
caps/src/nsScriptSecurityManager.cpp
content/xbl/src/nsXBLPrototypeBinding.cpp
dom/src/base/nsDOMClassInfo.cpp
dom/src/base/nsScriptNameSpaceManager.cpp
extensions/java/xpcom/src/nsJavaWrapper.cpp
extensions/java/xpcom/src/nsJavaXPTCStub.cpp
extensions/java/xpcom/tools/genifaces/GenerateJavaInterfaces.cpp
extensions/python/xpcom/src/PyIInterfaceInfo.cpp
js/src/xpconnect/src/xpccomponents.cpp
toolkit/components/places/src/nsNavBookmarks.cpp
xpcom/reflect/xptinfo/src/xptiManifest.cpp
--- a/caps/src/nsNullPrincipal.cpp
+++ b/caps/src/nsNullPrincipal.cpp
@@ -41,16 +41,17 @@
  * anything other than itself and chrome; null principals are not
  * same-origin with anything but themselves.
  */
 
 #include "nsNullPrincipal.h"
 #include "nsMemory.h"
 #include "nsIUUIDGenerator.h"
 #include "nsID.h"
+#include "prmem.h" // For PF_Free, 'cause nsID::ToString sucks like that
 #include "nsNetUtil.h"
 #include "nsIClassInfoImpl.h"
 #include "nsNetCID.h"
 
 static NS_DEFINE_CID(kSimpleURICID, NS_SIMPLEURI_CID);
 
 NS_IMPL_QUERY_INTERFACE2_CI(nsNullPrincipal,
                             nsIPrincipal,
@@ -99,29 +100,31 @@ nsNullPrincipal::Init()
   nsCOMPtr<nsIUUIDGenerator> uuidgen =
     do_GetService("@mozilla.org/uuid-generator;1", &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsID id;
   rv = uuidgen->GenerateUUIDInPlace(&id);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  char chars[NSID_LENGTH];
-  id.ToProvidedString(chars);
+  char* chars = id.ToString();
+  NS_ENSURE_TRUE(chars, NS_ERROR_OUT_OF_MEMORY);
 
-  PRUint32 suffixLen = NSID_LENGTH - 1;
+  PRUint32 suffixLen = strlen(chars);
   PRUint32 prefixLen = NS_ARRAY_LENGTH(NS_NULLPRINCIPAL_PREFIX) - 1;
 
   // Use an nsCString so we only do the allocation once here and then share
   // with nsJSPrincipals
   nsCString str;
   str.SetCapacity(prefixLen + suffixLen);
 
   str.Append(NS_NULLPRINCIPAL_PREFIX);
   str.Append(chars);
+
+  PR_Free(chars);
   
   if (str.Length() != prefixLen + suffixLen) {
     NS_WARNING("Out of memory allocating null-principal URI");
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   // Use CID so we're sure we get the impl we want.  Note that creating the URI
   // directly is ok because we have our own private URI scheme.  In effect,
--- a/caps/src/nsScriptSecurityManager.cpp
+++ b/caps/src/nsScriptSecurityManager.cpp
@@ -3067,18 +3067,18 @@ nsScriptSecurityManager::CanCreateInstan
     {
         rv = CheckComponentPermissions(cx, aCID);
     }
     if (NS_FAILED(rv))
 #endif
     {
         //-- Access denied, report an error
         nsCAutoString errorMsg("Permission denied to create instance of class. CID=");
-        char cidStr[NSID_LENGTH];
-        aCID.ToProvidedString(cidStr);
+        nsXPIDLCString cidStr;
+        cidStr += aCID.ToString();
         errorMsg.Append(cidStr);
         SetPendingException(cx, errorMsg.get());
 
 #ifdef DEBUG_CAPS_CanCreateInstance
         printf("DENIED\n");
     }
     else
     {
@@ -3098,18 +3098,18 @@ nsScriptSecurityManager::CanGetService(J
     nsCRT::free(cidStr);
 #endif
 
     nsresult rv = CheckXPCPermissions(nsnull, nsnull);
     if (NS_FAILED(rv))
     {
         //-- Access denied, report an error
         nsCAutoString errorMsg("Permission denied to get service. CID=");
-        char cidStr[NSID_LENGTH];
-        aCID.ToProvidedString(cidStr);
+        nsXPIDLCString cidStr;
+        cidStr += aCID.ToString();
         errorMsg.Append(cidStr);
         SetPendingException(cx, errorMsg.get());
 
 #ifdef DEBUG_CAPS_CanGetService
         printf("DENIED\n");
     }
     else
     {
--- a/content/xbl/src/nsXBLPrototypeBinding.cpp
+++ b/content/xbl/src/nsXBLPrototypeBinding.cpp
@@ -1344,44 +1344,51 @@ nsXBLPrototypeBinding::ConstructInterfac
     char* token = nsCRT::strtok( str, ", ", &newStr );
     while( token != NULL ) {
       // get the InterfaceInfo for the name
       nsCOMPtr<nsIInterfaceInfo> iinfo;
       infoManager->GetInfoForName(token, getter_AddRefs(iinfo));
 
       if (iinfo) {
         // obtain an IID.
-        const nsIID* iid = nsnull;
-        iinfo->GetIIDShared(&iid);
+        nsIID* iid = nsnull;
+        iinfo->GetInterfaceIID(&iid);
 
         if (iid) {
           // We found a valid iid.  Add it to our table.
           nsIIDKey key(*iid);
           mInterfaceTable->Put(&key, mBinding);
 
           // this block adds the parent interfaces of each interface
           // defined in the xbl definition (implements="nsI...")
           nsCOMPtr<nsIInterfaceInfo> parentInfo;
           // if it has a parent, add it to the table
           while (NS_SUCCEEDED(iinfo->GetParent(getter_AddRefs(parentInfo))) && parentInfo) {
+            // free the nsMemory::Clone()ed iid
+            nsMemory::Free(iid);
+
             // get the iid
-            parentInfo->GetIIDShared(&iid);
+            parentInfo->GetInterfaceIID(&iid);
 
             // don't add nsISupports to the table
             if (!iid || iid->Equals(NS_GET_IID(nsISupports)))
               break;
 
             // add the iid to the table
             nsIIDKey parentKey(*iid);
             mInterfaceTable->Put(&parentKey, mBinding);
 
             // look for the next parent
             iinfo = parentInfo;
           }
         }
+
+        // free the nsMemory::Clone()ed iid
+        if (iid)
+          nsMemory::Free(iid);
       }
 
       token = nsCRT::strtok( newStr, ", ", &newStr );
     }
   }
 
   return NS_OK;
 }
--- a/dom/src/base/nsDOMClassInfo.cpp
+++ b/dom/src/base/nsDOMClassInfo.cpp
@@ -1701,31 +1701,34 @@ nsDOMClassInfo::RegisterClassProtos(PRIn
   NS_ENSURE_TRUE(iim, NS_ERROR_NOT_AVAILABLE);
 
   nsCOMPtr<nsIInterfaceInfo> if_info;
   PRBool first = PR_TRUE;
 
   iim->GetInfoForIID(primary_iid, getter_AddRefs(if_info));
 
   while (if_info) {
-    const nsIID *iid = nsnull;
-
-    if_info->GetIIDShared(&iid);
+    nsIID *iid = nsnull;
+
+    if_info->GetInterfaceIID(&iid);
     NS_ENSURE_TRUE(iid, NS_ERROR_UNEXPECTED);
 
     if (iid->Equals(NS_GET_IID(nsISupports))) {
+      nsMemory::Free(iid);
+
       break;
     }
 
-    const char *name = nsnull;
-    if_info->GetNameShared(&name);
-    NS_ENSURE_TRUE(name, NS_ERROR_UNEXPECTED);
+    nsXPIDLCString name;
+    if_info->GetName(getter_Copies(name));
 
     nameSpaceManager->RegisterClassProto(CutPrefix(name), iid, &found_old);
 
+    nsMemory::Free(iid);
+
     if (first) {
       first = PR_FALSE;
     } else if (found_old) {
       break;
     }
 
     nsCOMPtr<nsIInterfaceInfo> tmp(if_info);
     tmp->GetParent(getter_AddRefs(if_info));
@@ -5322,19 +5325,17 @@ nsWindowSH::GlobalResolve(nsGlobalWindow
     const nsIID *primary_iid = &NS_GET_IID(nsISupports);
 
     if (name_struct->mType == nsGlobalNameStruct::eTypeClassProto) {
       primary_iid = &name_struct->mIID;
     } else if (ci_data && ci_data->mProtoChainInterface) {
       primary_iid = ci_data->mProtoChainInterface;
     }
 
-    nsCOMPtr<nsIInterfaceInfo> if_info;
-    nsCOMPtr<nsIInterfaceInfo> parent;
-    const char *class_parent_name = nsnull;
+    nsXPIDLCString class_parent_name;
 
     if (!primary_iid->Equals(NS_GET_IID(nsISupports))) {
       rv = DefineInterfaceConstants(cx, class_obj, primary_iid);
       NS_ENSURE_SUCCESS(rv, rv);
 
       // Special case for |Node|, which needs constants from Node3
       // too for forwards compatibility.
       if (primary_iid->Equals(NS_GET_IID(nsIDOMNode))) {
@@ -5350,49 +5351,53 @@ nsWindowSH::GlobalResolve(nsGlobalWindow
                                       &NS_GET_IID(nsIDOMNSEvent));
         NS_ENSURE_SUCCESS(rv, rv);
       }
 
       nsCOMPtr<nsIInterfaceInfoManager>
         iim(do_GetService(NS_INTERFACEINFOMANAGER_SERVICE_CONTRACTID));
       NS_ENSURE_TRUE(iim, NS_ERROR_NOT_AVAILABLE);
 
+      nsCOMPtr<nsIInterfaceInfo> if_info;
       iim->GetInfoForIID(primary_iid, getter_AddRefs(if_info));
       NS_ENSURE_TRUE(if_info, NS_ERROR_UNEXPECTED);
 
-      const nsIID *iid = nsnull;
+      nsCOMPtr<nsIInterfaceInfo> parent;
+      nsIID *iid = nsnull;
 
       if (ci_data && !ci_data->mHasClassInterface) {
-        if_info->GetIIDShared(&iid);
+        if_info->GetInterfaceIID(&iid);
       } else {
         if_info->GetParent(getter_AddRefs(parent));
         NS_ENSURE_TRUE(parent, NS_ERROR_UNEXPECTED);
 
-        parent->GetIIDShared(&iid);
+        parent->GetInterfaceIID(&iid);
       }
 
       if (iid) {
         if (!iid->Equals(NS_GET_IID(nsISupports))) {
           if (ci_data && !ci_data->mHasClassInterface) {
             // If the class doesn't have a class interface the primary
             // interface is the interface that should be
             // constructor.prototype.__proto__.
 
-            if_info->GetNameShared(&class_parent_name);
+            if_info->GetName(getter_Copies(class_parent_name));
           } else {
             // If the class does have a class interface (or there's no
             // real class for this name) then the parent of the
             // primary interface is what we want on
             // constructor.prototype.__proto__.
 
             NS_ASSERTION(parent, "Whoa, this is bad, null parent here!");
 
-            parent->GetNameShared(&class_parent_name);
+            parent->GetName(getter_Copies(class_parent_name));
           }
         }
+
+        nsMemory::Free(iid);
       }
     }
 
     JSObject *proto = nsnull;
 
     if (class_parent_name) {
       jsval val;
 
--- a/dom/src/base/nsScriptNameSpaceManager.cpp
+++ b/dom/src/base/nsScriptNameSpaceManager.cpp
@@ -306,27 +306,27 @@ nsScriptNameSpaceManager::FillHashWithDO
 
     NS_WARNING("What, no nsIDOM interfaces installed?");
 
     return NS_OK;
   }
 
   PRBool found_old;
   nsCOMPtr<nsIInterfaceInfo> if_info;
-  const char *if_name = nsnull;
+  nsXPIDLCString if_name;
   const nsIID *iid;
 
   for ( ; domInterfaces->IsDone() == NS_ENUMERATOR_FALSE; domInterfaces->Next()) {
     rv = domInterfaces->CurrentItem(getter_AddRefs(entry));
     NS_ENSURE_SUCCESS(rv, rv);
 
     nsCOMPtr<nsIInterfaceInfo> if_info(do_QueryInterface(entry));
-    if_info->GetNameShared(&if_name);
+    if_info->GetName(getter_Copies(if_name));
     if_info->GetIIDShared(&iid);
-    rv = RegisterInterface(if_name + sizeof(NS_DOM_INTERFACE_PREFIX) - 1,
+    rv = RegisterInterface(if_name.get() + sizeof(NS_DOM_INTERFACE_PREFIX) - 1,
                            iid, &found_old);
 
 #ifdef DEBUG
     NS_ASSERTION(!found_old,
                  "Whaaa, interface name already in hash!");
 #endif
   }
 
--- a/extensions/java/xpcom/src/nsJavaWrapper.cpp
+++ b/extensions/java/xpcom/src/nsJavaWrapper.cpp
@@ -1132,23 +1132,25 @@ FinalizeParams(JNIEnv *env, const nsXPTP
       nsID* iid = static_cast<nsID*>(aVariant.val.p);
 
       if ((aParamInfo.IsOut() || aIsArrayElement) &&
           NS_SUCCEEDED(aInvokeResult))
       {
         // Create the string from nsID
         jstring str = nsnull;
         if (iid) {
-          char iid_str[NSID_LENGTH];
-          iid->ToProvidedString(iid_str);
-          str = env->NewStringUTF(iid_str);
-          if (!str) {
+          char* iid_str = iid->ToString();
+          if (iid_str) {
+            str = env->NewStringUTF(iid_str);
+          }
+          if (!iid_str || !str) {
             rv = NS_ERROR_OUT_OF_MEMORY;
             break;
           }
+          PR_Free(iid_str);
         }
 
         if (aParamInfo.IsRetval() && !aIsArrayElement) {
           *aParam = str;
         } else if (*aParam) {
           // put new string into output array
           env->SetObjectArrayElement((jobjectArray) *aParam, aIndex, str);
         }
--- a/extensions/java/xpcom/src/nsJavaXPTCStub.cpp
+++ b/extensions/java/xpcom/src/nsJavaXPTCStub.cpp
@@ -861,23 +861,25 @@ nsJavaXPTCStub::SetupJavaParams(const ns
         iid = static_cast<nsID*>(aVariant.val.p);
       } else if (aVariant.val.p) {  // 'inout' & 'out'
         nsID** variant = static_cast<nsID**>(aVariant.val.p);
         iid = *variant;
       }
 
       jobject str = nsnull;
       if (iid) {
-        char iid_str[NSID_LENGTH];
-        iid->ToProvidedString(iid_str);
-        str = env->NewStringUTF(iid_str);
-        if (!str) {
+        char* iid_str = iid->ToString();
+        if (iid_str) {
+          str = env->NewStringUTF(iid_str);
+        }
+        if (!iid_str || !str) {
           rv = NS_ERROR_OUT_OF_MEMORY;
           break;
         }
+        PR_Free(iid_str);
       }
 
       if (!aParamInfo.IsOut()) {  // 'in'
         aJValue.l = str;
         aMethodSig.AppendLiteral("Ljava/lang/String;");
       } else {  // 'inout' & 'out'
         if (aVariant.val.p) {
           aJValue.l = env->NewObjectArray(1, stringClass, str);
@@ -1703,9 +1705,9 @@ nsJavaXPTCStub::GetNewOrUsed(JNIEnv* env
     delete stub;
     return rv;
   }
 
   NS_ADDREF(stub);
   *aResult = stub;
 
   return NS_OK;
-}
+}
\ No newline at end of file
--- a/extensions/java/xpcom/tools/genifaces/GenerateJavaInterfaces.cpp
+++ b/extensions/java/xpcom/tools/genifaces/GenerateJavaInterfaces.cpp
@@ -411,49 +411,54 @@ public:
   }
 
   nsresult WriteIID(nsIOutputStream* out, nsIInterfaceInfo* aIInfo)
   {
     static const char kIIDDecl1[] = "  String ";
     static const char kIIDDecl2[] = " =\n    \"";
     static const char kIIDDecl3[] = "\";\n\n";
 
-    nsIID* iid;
-    aIInfo->GetIIDShared(&iid);
+    nsIID* iid = nsnull;
+    aIInfo->GetInterfaceIID(&iid);
+    if (!iid)
+      return NS_ERROR_OUT_OF_MEMORY;
 
     // create iid field name
     nsCAutoString iid_name;
     const char* iface_name;
     aIInfo->GetNameShared(&iface_name);
     if (strncmp("ns", iface_name, 2) == 0) {
       iid_name.Append(NS_LITERAL_CSTRING("NS_"));
       iid_name.Append(iface_name + 2);
     } else {
       iid_name.Append(iface_name);
     }
     iid_name.Append("_IID");
     ToUpperCase(iid_name);
 
     // get iid string
-    char iid_str[NSID_LENGTH];
-    iid->ToProvidedString(iid_str);
+    char* iid_str = iid->ToString();
+    if (!iid_str)
+      return NS_ERROR_OUT_OF_MEMORY;
 
     PRUint32 count;
     nsresult rv = out->Write(kIIDDecl1, sizeof(kIIDDecl1) - 1, &count);
     NS_ENSURE_SUCCESS(rv, rv);
     rv = out->Write(iid_name.get(), iid_name.Length(), &count);
     NS_ENSURE_SUCCESS(rv, rv);
     rv = out->Write(kIIDDecl2, sizeof(kIIDDecl2) - 1, &count);
     NS_ENSURE_SUCCESS(rv, rv);
     rv = out->Write(iid_str, strlen(iid_str), &count);
     NS_ENSURE_SUCCESS(rv, rv);
     rv = out->Write(kIIDDecl3, sizeof(kIIDDecl3) - 1, &count);
     NS_ENSURE_SUCCESS(rv, rv);
 
     // cleanup
+    PR_Free(iid_str);
+    nsMemory::Free(iid);
     return NS_OK;
   }
 
   nsresult WriteConstants(nsIOutputStream* out, nsIInterfaceInfo* aIInfo,
                           PRUint16 aParentConstCount)
   {
     static const char kConstDecl1[] = " = ";
     static const char kConstDecl2[] = ";\n\n";
--- a/extensions/python/xpcom/src/PyIInterfaceInfo.cpp
+++ b/extensions/python/xpcom/src/PyIInterfaceInfo.cpp
@@ -86,21 +86,22 @@ static PyObject *PyGetIID(PyObject *self
 
 	nsIInterfaceInfo *pI = GetI(self);
 	if (pI==NULL)
 		return NULL;
 
 	nsIID *iid_ret;
 	nsresult r;
 	Py_BEGIN_ALLOW_THREADS;
-	r = pI->GetIIDShared(&iid_ret);
+	r = pI->GetInterfaceIID(&iid_ret);
 	Py_END_ALLOW_THREADS;
 	if ( NS_FAILED(r) )
 		return PyXPCOM_BuildPyException(r);
 	PyObject *ret = Py_nsIID::PyObjectFromIID(*iid_ret);
+	nsMemory::Free(iid_ret);
 	return ret;
 }
 
 static PyObject *PyIsScriptable(PyObject *self, PyObject *args)
 {
 	if (!PyArg_ParseTuple(args, ":IsScriptable"))
 		return NULL;
 
--- a/js/src/xpconnect/src/xpccomponents.cpp
+++ b/js/src/xpconnect/src/xpccomponents.cpp
@@ -617,30 +617,31 @@ nsXPCComponents_InterfacesByID::NewEnume
                 if(NS_ENUMERATOR_FALSE == e->IsDone() &&
                    NS_SUCCEEDED(e->CurrentItem(getter_AddRefs(isup))) && isup)
                 {
                     e->Next();
                     nsCOMPtr<nsIInterfaceInfo> iface(do_QueryInterface(isup));
                     if(iface)
                     {
                         nsIID const *iid;
-                        char idstr[NSID_LENGTH];
+                        char* idstr;
                         JSString* jsstr;
                         PRBool scriptable;
 
                         if(NS_SUCCEEDED(iface->IsScriptable(&scriptable)) &&
                            !scriptable)
                         {
                             continue;
                         }
 
-                        if(NS_SUCCEEDED(iface->GetIIDShared(&iid)))
+                        if(NS_SUCCEEDED(iface->GetIIDShared(&iid)) &&
+                           nsnull != (idstr = iid->ToString()))
                         {
-                            iid->ToProvidedString(idstr);
                             jsstr = JS_NewStringCopyZ(cx, idstr);
+                            nsMemory::Free(idstr);
                             if (jsstr &&
                                 JS_ValueToId(cx, STRING_TO_JSVAL(jsstr), idp))
                             {
                                 return NS_OK;
                             }
                         }
                     }
                 }
--- a/toolkit/components/places/src/nsNavBookmarks.cpp
+++ b/toolkit/components/places/src/nsNavBookmarks.cpp
@@ -44,16 +44,17 @@
 #include "nsNetUtil.h"
 #include "nsIDynamicContainer.h"
 #include "nsUnicharUtils.h"
 #include "nsFaviconService.h"
 #include "nsAnnotationService.h"
 #include "nsPrintfCString.h"
 #include "nsAutoLock.h"
 #include "nsIUUIDGenerator.h"
+#include "prmem.h"
 #include "prprf.h"
 
 const PRInt32 nsNavBookmarks::kFindBookmarksIndex_ID = 0;
 const PRInt32 nsNavBookmarks::kFindBookmarksIndex_Type = 1;
 const PRInt32 nsNavBookmarks::kFindBookmarksIndex_ForeignKey = 2;
 const PRInt32 nsNavBookmarks::kFindBookmarksIndex_Parent = 3;
 const PRInt32 nsNavBookmarks::kFindBookmarksIndex_Position = 4;
 const PRInt32 nsNavBookmarks::kFindBookmarksIndex_Title = 5;
@@ -273,19 +274,20 @@ nsNavBookmarks::Init()
   NS_ENSURE_SUCCESS(rv, rv);
 
   // generate a new GUID base for this session
   nsCOMPtr<nsIUUIDGenerator> uuidgen = do_GetService("@mozilla.org/uuid-generator;1", &rv);
   NS_ENSURE_SUCCESS(rv, rv);
   nsID GUID;
   rv = uuidgen->GenerateUUIDInPlace(&GUID);
   NS_ENSURE_SUCCESS(rv, rv);
-  char GUIDChars[NSID_LENGTH];
-  GUID.ToProvidedString(GUIDChars);
-  CopyASCIItoUTF16(GUIDChars, mGUIDBase);
+  char* GUIDChars = GUID.ToString();
+  NS_ENSURE_TRUE(GUIDChars, NS_ERROR_OUT_OF_MEMORY);
+  mGUIDBase.Assign(NS_ConvertASCIItoUTF16(GUIDChars));
+  PR_Free(GUIDChars);
 
   rv = InitRoots();
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = transaction.Commit();
   NS_ENSURE_SUCCESS(rv, rv);
 
   mLock = PR_NewLock();
@@ -1732,20 +1734,19 @@ nsNavBookmarks::GetItemGUID(PRInt64 aIte
   nsAnnotationService* annosvc = nsAnnotationService::GetAnnotationService();
   NS_ENSURE_TRUE(annosvc, NS_ERROR_OUT_OF_MEMORY);
   nsresult rv = annosvc->GetItemAnnotationString(aItemId, GUID_ANNO, aGUID);
 
   if (NS_SUCCEEDED(rv) || rv != NS_ERROR_NOT_AVAILABLE)
     return rv;
 
   nsAutoString tmp;
+  tmp.Assign(mGUIDBase);
   tmp.AppendInt(mItemCount++);
-  aGUID.SetCapacity(NSID_LENGTH - 1 + tmp.Length());
-  aGUID.Assign(mGUIDBase);
-  aGUID.Append(tmp);
+  aGUID.Assign(tmp);
 
   return SetItemGUID(aItemId, aGUID);
 }
 
 NS_IMETHODIMP
 nsNavBookmarks::SetItemGUID(PRInt64 aItemId, const nsAString &aGUID)
 {
   PRInt64 checkId;
--- a/xpcom/reflect/xptinfo/src/xptiManifest.cpp
+++ b/xpcom/reflect/xptinfo/src/xptiManifest.cpp
@@ -91,30 +91,33 @@ CurrentAppDirMatchesPersistentDescriptor
 
 PR_STATIC_CALLBACK(PLDHashOperator)
 xpti_InterfaceWriter(PLDHashTable *table, PLDHashEntryHdr *hdr,
                      PRUint32 number, void *arg)
 {
     xptiInterfaceEntry* entry = ((xptiHashEntry*)hdr)->value;
     PRFileDesc* fd = (PRFileDesc*)  arg;
 
-    char iidStr[NSID_LENGTH];
-    entry->GetTheIID()->ToProvidedString(iidStr);
+    char* iidStr = entry->GetTheIID()->ToString();
+    if(!iidStr)
+        return PL_DHASH_STOP;
 
     const xptiTypelib& typelib = entry->GetTypelibRecord();
 
     PRBool success =  !!PR_fprintf(fd, "%d,%s,%s,%d,%d,%d\n",
                                    (int) number,
                                    entry->GetTheName(),
                                    iidStr,
                                    (int) typelib.GetFileIndex(),
                                    (int) (typelib.IsZip() ? 
                                    typelib.GetZipItemIndex() : -1),
                                    (int) entry->GetScriptableFlag());
 
+    nsCRT::free(iidStr);
+
     return success ? PL_DHASH_NEXT : PL_DHASH_STOP;
 }
 
 
 // static
 PRBool xptiManifest::Write(xptiInterfaceInfoManager* aMgr,
                            xptiWorkingSet*           aWorkingSet)
 {