Skip to content

Commit 3f276ef

Browse files
committed
LLVMCodeBuilder: Fix string deallocation after stop instruction
1 parent 0eb6886 commit 3f276ef

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/engine/internal/llvm/llvmcodebuilder.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1246,6 +1246,7 @@ std::shared_ptr<ExecutableCode> LLVMCodeBuilder::finalize()
12461246
}
12471247

12481248
case LLVMInstruction::Type::Stop: {
1249+
freeScopeHeap();
12491250
m_builder.CreateBr(endBranch);
12501251
llvm::BasicBlock *nextBranch = llvm::BasicBlock::Create(m_llvmCtx, "", m_function);
12511252
m_builder.SetInsertPoint(nextBranch);
@@ -1309,11 +1310,11 @@ std::shared_ptr<ExecutableCode> LLVMCodeBuilder::finalize()
13091310
}
13101311
}
13111312

1313+
assert(m_stringHeap.size() == 1);
1314+
freeScopeHeap();
13121315
m_builder.CreateBr(endBranch);
13131316

13141317
m_builder.SetInsertPoint(endBranch);
1315-
assert(m_stringHeap.size() == 1);
1316-
freeScopeHeap();
13171318
syncVariables(targetVariables);
13181319

13191320
// End and verify the function

0 commit comments

Comments
 (0)