summaryrefslogtreecommitdiff
path: root/include/llvm/ADT/StringMap.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/ADT/StringMap.h')
-rw-r--r--include/llvm/ADT/StringMap.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/include/llvm/ADT/StringMap.h b/include/llvm/ADT/StringMap.h
index d4daf53178..f7f940944c 100644
--- a/include/llvm/ADT/StringMap.h
+++ b/include/llvm/ADT/StringMap.h
@@ -198,8 +198,10 @@ public:
template<typename AllocatorTy>
void Destroy(AllocatorTy &Allocator) {
// Free memory referenced by the item.
+ unsigned AllocSize =
+ static_cast<unsigned>(sizeof(StringMapEntry)) + getKeyLength() + 1;
this->~StringMapEntry();
- Allocator.Deallocate(this);
+ Allocator.Deallocate(static_cast<void *>(this), AllocSize);
}
/// Destroy this object, releasing memory back to the malloc allocator.