Bug 1445601 - Stop using LoadLibraryA in replace_malloc. r=glandium
MozReview-Commit-ID: 8EzDtCIlg7F
--- a/memory/build/mozjemalloc.cpp
+++ b/memory/build/mozjemalloc.cpp
@@ -120,16 +120,17 @@
#ifdef XP_DARWIN
#include <libkern/OSAtomic.h>
#include <mach/mach_init.h>
#include <mach/vm_map.h>
#endif
#include "mozilla/Atomics.h"
#include "mozilla/Alignment.h"
+#include "mozilla/ArrayUtils.h"
#include "mozilla/Assertions.h"
#include "mozilla/Attributes.h"
#include "mozilla/CheckedInt.h"
#include "mozilla/DoublyLinkedList.h"
#include "mozilla/Likely.h"
#include "mozilla/MathAlgorithms.h"
#include "mozilla/Sprintf.h"
// Note: MozTaggedAnonymousMmap() could call an LD_PRELOADed mmap
@@ -4680,21 +4681,21 @@ static replace_init_impl_t* replace_init
#endif
#ifdef XP_WIN
typedef HMODULE replace_malloc_handle_t;
static replace_malloc_handle_t
replace_malloc_handle()
{
- char replace_malloc_lib[1024];
- if (GetEnvironmentVariableA("MOZ_REPLACE_MALLOC_LIB",
+ wchar_t replace_malloc_lib[1024];
+ if (GetEnvironmentVariableW(L"MOZ_REPLACE_MALLOC_LIB",
replace_malloc_lib,
- sizeof(replace_malloc_lib)) > 0) {
- return LoadLibraryA(replace_malloc_lib);
+ ArrayLength(replace_malloc_lib)) > 0) {
+ return LoadLibraryW(replace_malloc_lib);
}
return nullptr;
}
#define REPLACE_MALLOC_GET_INIT_FUNC(handle) \
(replace_init_impl_t*)GetProcAddress(handle, "replace_init")
#elif defined(ANDROID)