Skip to content

Commit bf59a74

Browse files
committed
Make sure to run ~AllocatedValue, who knows what the compiler has done…
1 parent ef72a06 commit bf59a74

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/Interpreter/Value.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ namespace {
9696
while (m_NElements-- != 0)
9797
(*m_DtorFunc)(Payload + m_NElements * Skip);
9898
}
99+
this->~AllocatedValue();
99100
delete [] (char*)this;
100101
}
101102
}
@@ -221,7 +222,7 @@ namespace cling {
221222
dtorFunc = m_Interpreter->compileDtorCallFor(RTy->getDecl());
222223

223224
const clang::ASTContext& ctx = getASTContext();
224-
unsigned payloadSize = ctx.getTypeSizeInChars(getType()).getQuantity();
225+
const auto payloadSize = ctx.getTypeSizeInChars(getType()).getQuantity();
225226
char* alloc = new char[AllocatedValue::getPayloadOffset() + payloadSize];
226227
AllocatedValue* allocVal = new (alloc) AllocatedValue(dtorFunc, payloadSize,
227228
GetNumberOfElements());

0 commit comments

Comments
 (0)