diff --git a/src/xercesc/util/XMemory.cpp b/src/xercesc/util/XMemory.cpp index 735e0722831f16b86fd7309ea4b99992db385863..0f89e47e83810b99f83b906a60a50e66d103b4ff 100644 --- a/src/xercesc/util/XMemory.cpp +++ b/src/xercesc/util/XMemory.cpp @@ -116,15 +116,19 @@ void XMemory::operator delete(void* p, MemoryManager* manager) { assert(manager != 0); - if (p != 0) - { - size_t headerSize = XMLPlatformUtils::alignPointerForNewBlockAllocation( - sizeof(MemoryManager*)); + if (p != 0) + { + size_t headerSize = XMLPlatformUtils::alignPointerForNewBlockAllocation(sizeof(MemoryManager*)); void* const block = (char*)p - headerSize; - - assert(*(MemoryManager**)block == manager); - manager->deallocate(block); - } + assert(*(MemoryManager**)block == manager); + /*** + * NOTE: for compiler which can't properly trace the memory manager used in the + * placement new, we use the memory manager embedded in the memory rather + * than the one passed in + */ + MemoryManager* pM = *(MemoryManager**)block; + pM->deallocate(block); + } } #endif