Bug 860886 - Make MOZ_CC_LOG_DIRECTORY work again; r=mccr8
authorEhsan Akhgari <ehsan@mozilla.com>
Thu, 11 Apr 2013 15:39:20 -0400
changeset 128517 aa2d9eb8463312e49fa08ec8e2767c1b0c30c867
parent 128516 3880c0cfd2885dfb0a3324ebcc208228321cb7a7
child 128518 ab0974ead0303984c4c05d75da102978bd6131dd
push id26357
push usereakhgari@mozilla.com
push dateThu, 11 Apr 2013 23:05:25 +0000
treeherdermozilla-inbound@aa2d9eb84633 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs860886
milestone23.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 860886 - Make MOZ_CC_LOG_DIRECTORY work again; r=mccr8
xpcom/base/nsCycleCollector.cpp
--- a/xpcom/base/nsCycleCollector.cpp
+++ b/xpcom/base/nsCycleCollector.cpp
@@ -1598,26 +1598,28 @@ private:
         nsPrintfCString filename("%s.%d%s%s.log",
             aPrefix,
             base::GetCurrentProcId(),
             mFilenameIdentifier.IsEmpty() ? "" : ".",
             NS_ConvertUTF16toUTF8(mFilenameIdentifier).get());
 
         // Get the log directory either from $MOZ_CC_LOG_DIRECTORY or from
         // the fallback directories in OpenTempFile.
-        nsCOMPtr<nsIFile> logFile;
+        nsIFile* logFile = nullptr;
         if (char* env = PR_GetEnv("MOZ_CC_LOG_DIRECTORY")) {
             NS_NewNativeLocalFile(nsCString(env), /* followLinks = */ true,
-                                  getter_AddRefs(logFile));
+                                  &logFile);
         }
-        nsresult rv = nsMemoryInfoDumper::OpenTempFile(filename,
-                                                       getter_AddRefs(logFile));
-        NS_ENSURE_SUCCESS(rv, nullptr);
-
-        return logFile.forget();
+        nsresult rv = nsMemoryInfoDumper::OpenTempFile(filename, &logFile);
+        if (NS_FAILED(rv)) {
+          NS_IF_RELEASE(logFile);
+          return nullptr;
+        }
+
+        return logFile;
     }
 
     FILE *mStream;
     nsCOMPtr<nsIFile> mOutFile;
     bool mWantAllTraces;
     bool mDisableLog;
     bool mWantAfterProcessing;
     nsString mFilenameIdentifier;