summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sandbox/src/sandbox_nt_util.cc6
-rw-r--r--sandbox/src/sandbox_nt_util.h6
2 files changed, 12 insertions, 0 deletions
diff --git a/sandbox/src/sandbox_nt_util.cc b/sandbox/src/sandbox_nt_util.cc
index 10399fe..1452c6b 100644
--- a/sandbox/src/sandbox_nt_util.cc
+++ b/sandbox/src/sandbox_nt_util.cc
@@ -560,6 +560,12 @@ void operator delete(void* memory, sandbox::AllocationType type) {
}
}
+void operator delete(void* memory, sandbox::AllocationType type,
+ void* near_to) {
+ UNREFERENCED_PARAMETER(near_to);
+ operator delete(memory, type);
+}
+
void* __cdecl operator new(size_t size, void* buffer,
sandbox::AllocationType type) {
UNREFERENCED_PARAMETER(size);
diff --git a/sandbox/src/sandbox_nt_util.h b/sandbox/src/sandbox_nt_util.h
index 99657f5..7a82302 100644
--- a/sandbox/src/sandbox_nt_util.h
+++ b/sandbox/src/sandbox_nt_util.h
@@ -13,6 +13,12 @@
void* __cdecl operator new(size_t size, sandbox::AllocationType type,
void* near_to = NULL);
void __cdecl operator delete(void* memory, sandbox::AllocationType type);
+// Add operator delete that matches the placement form of the operator new
+// above. This is required by compiler to generate code to call operator delete
+// in case the object's constructor throws an exception.
+// See http://msdn.microsoft.com/en-us/library/cxdxz3x6.aspx
+void __cdecl operator delete(void* memory, sandbox::AllocationType type,
+ void* near_to);
// Regular placement new and delete
void* __cdecl operator new(size_t size, void* buffer,