Bug 1328569 - Don't call UnmapViewOfFile() with a null address. r?froydnj
MozReview-Commit-ID: Ca5n8rSXQ4x
--- a/xpcom/io/FileUtilsWin.cpp
+++ b/xpcom/io/FileUtilsWin.cpp
@@ -4,32 +4,35 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "FileUtilsWin.h"
#include <windows.h>
#include <psapi.h>
+#include "mozilla/Unused.h"
#include "nsWindowsHelpers.h"
#include "GeckoProfiler.h"
namespace {
// Scoped type used by HandleToFilename
struct ScopedMappedViewTraits
{
typedef void* type;
static void* empty()
{
return nullptr;
}
static void release(void* aPtr)
{
- UnmapViewOfFile(aPtr);
+ if (aPtr) {
+ mozilla::Unused << UnmapViewOfFile(aPtr);
+ }
}
};
typedef mozilla::Scoped<ScopedMappedViewTraits> ScopedMappedView;
} // namespace
namespace mozilla {