Bug 1228482 - Fix compile error with VS2015 and memory leak in nsEdgeReadingListExtractor. r=bas
authorXidorn Quan <quanxunzhen@gmail.com>
Fri, 27 Nov 2015 16:29:23 +1100
changeset 274534 4f04c4b2cf602d383d5125ca7d8080ec2ad652b9
parent 274533 350ecdaedef88b5007e0d47002ac6a36c951dc45
child 274535 6eeb5d9cc0d8a34303fa6871a58e0b130ec55131
push id29734
push usercbook@mozilla.com
push dateMon, 30 Nov 2015 12:19:25 +0000
treeherdermozilla-central@a18630f9ab42 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbas
bugs1228482
milestone45.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 1228482 - Fix compile error with VS2015 and memory leak in nsEdgeReadingListExtractor. r=bas
browser/components/migration/nsEdgeReadingListExtractor.cpp
--- a/browser/components/migration/nsEdgeReadingListExtractor.cpp
+++ b/browser/components/migration/nsEdgeReadingListExtractor.cpp
@@ -194,17 +194,21 @@ nsEdgeReadingListExtractor::ConvertJETEr
     case JET_errAccessDenied:
       return NS_ERROR_FILE_ACCESS_DENIED;
     case JET_errInvalidFilename:
       return NS_ERROR_FILE_INVALID_PATH;
     case JET_errFileNotFound:
       return NS_ERROR_FILE_NOT_FOUND;
     case JET_errDatabaseDirtyShutdown:
       return NS_ERROR_FILE_CORRUPTED;
-    default:
-      nsCOMPtr<nsIConsoleService> consoleService = do_GetService(NS_CONSOLESERVICE_CONTRACTID);
-      wchar_t* msg = new wchar_t[80];
-      swprintf(msg, 80, MOZ_UTF16("Unexpected JET error from ESE database: %ld"), aError);
-      consoleService->LogStringMessage(msg);
+    default: {
+      nsCOMPtr<nsIConsoleService>
+        consoleService = do_GetService(NS_CONSOLESERVICE_CONTRACTID);
+      static const char16ptr_t
+        kFormat = MOZ_UTF16("Unexpected JET error from ESE database: %ld");
+      wchar_t msg[80];
+      swprintf(msg, mozilla::ArrayLength(msg), kFormat, aError);
+      consoleService->LogStringMessage(char16ptr_t(msg));
       return NS_ERROR_FAILURE;
+    }
   }
 }