*aResult = nsXPIDLCString::Copy(finalURL);  return NS_OK;
nsCRT::free(finalURI); return NS_OK;
nsChromeRegistry::ConvertChromeURL(nsIURI* aChromeURL, char** aResult){  nsresult rv = NS_OK;  NS_ASSERTION(aChromeURL, "null url!");  if (!aChromeURL)      return NS_ERROR_NULL_POINTER;  // First canonify the beast  rv = Canonify(aChromeURL);  if (NS_FAILED(rv)) return rv;  // Obtain the package, provider and remaining from the URL  nsCAutoString package, provider, remaining;  rv = SplitURL(aChromeURL, package, provider, remaining);  if (NS_FAILED(rv)) return rv;  if (!mProfileInitialized) {    // Just setSpec     rv = GetInstallRoot(mInstallRoot);    if (NS_FAILED(rv)) return rv;    rv = LoadProfileDataSource();    if (NS_FAILED(rv)) return rv;  }   nsCAutoString finalURL;  rv = GetBaseURL(package, provider, finalURL);#ifdef DEBUG  if (NS_FAILED(rv)) {    nsCAutoString msg("chrome: failed to get base url");    nsXPIDLCString url;    rv = aChromeURL->GetSpec(getter_Copies(url));    if (NS_SUCCEEDED(rv)) {      msg += " for ";      msg += (const char*)url;    }    msg += " -- using wacky default";    NS_WARNING((const char*)msg);  }#endif  if (finalURL.IsEmpty()) {    // hard-coded fallback    if (provider.Equals("skin")) {      finalURL = "resource:/chrome/skins/classic/";    }    else if (provider.Equals("locale")) {      finalURL = "resource:/chrome/locales/en-US/";    }    else if (package.Equals("aim")) {      finalURL = "resource:/chrome/packages/aim/";    }    else if (package.Equals("messenger")) {      finalURL = "resource:/chrome/packages/messenger/";    }    else if (package.Equals("global")) {      finalURL = "resource:/chrome/packages/widget-toolkit/";    }    else {      finalURL = "resource:/chrome/packages/core/";    }  }   finalURL += remaining;  *aResult = nsXPIDLCString::Copy(finalURL);  return NS_OK;}