char* MemoryLeakDetector::reallocMemory(TestMemoryAllocator* allocator, char* memory, size_t size, const char* file, int line, bool allocatNodesSeperately) { if (memory) { MemoryLeakDetectorNode* node = memoryTable_.removeNode(memory); if (node == NULL) { outputBuffer_.reportDeallocateNonAllocatedMemoryFailure(file, line, allocator, reporter_); return NULL; } checkForCorruption(node, file, line, allocator, allocatNodesSeperately); } return reallocateMemoryAndLeakInformation(allocator, memory, size, file, line, allocatNodesSeperately); }
char* MemoryLeakDetector::reallocMemory(TestMemoryAllocator* allocator, char* memory, size_t size, const char* file, int line, bool allocatNodesSeperately) { if (memory) { MemoryLeakDetectorNode* node = memoryTable_.removeNode(memory); if (node == NULL) { reportFailure(MEM_LEAK_DEALLOC_NON_ALLOCATED, "<unknown>", 0, 0, NullUnknownAllocator::defaultAllocator(), file, line, allocator); return NULL; } checkForCorruption(node, file, line, allocator, allocatNodesSeperately); } return reallocateMemoryAndLeakInformation(allocator, memory, size, file, line, allocatNodesSeperately); }
void MemoryLeakDetector::deallocMemory(TestMemoryAllocator* allocator, void* memory, const char* file, int line, bool allocatNodesSeperately) { if (memory == 0) return; MemoryLeakDetectorNode* node = memoryTable_.removeNode((char*) memory); if (node == NULL) { outputBuffer_.reportDeallocateNonAllocatedMemoryFailure(file, line, allocator, reporter_); return; } if (!allocator->hasBeenDestroyed()) { checkForCorruption(node, file, line, allocator, allocatNodesSeperately); allocator->free_memory((char*) memory, file, line); } }
void MemoryLeakDetector::deallocMemory(TestMemoryAllocator* allocator, void* memory, const char* file, int line, bool allocatNodesSeperately) { if (memory == 0) return; MemoryLeakDetectorNode* node = memoryTable_.removeNode((char*) memory); if (node == NULL) { reportFailure(MEM_LEAK_DEALLOC_NON_ALLOCATED, "<unknown>", 0, 0, NullUnknownAllocator::defaultAllocator(), file, line, allocator); return; } if (!allocator->hasBeenDestroyed()) { checkForCorruption(node, file, line, allocator, allocatNodesSeperately); allocator->free_memory((char*) memory, file, line); } }