diff --git a/llvm/unittests/CodeGen/MachineBasicBlockTest.cpp b/llvm/unittests/CodeGen/MachineBasicBlockTest.cpp index 3dd22353100c8d..8c9d05d2578d51 100644 --- a/llvm/unittests/CodeGen/MachineBasicBlockTest.cpp +++ b/llvm/unittests/CodeGen/MachineBasicBlockTest.cpp @@ -100,6 +100,9 @@ TEST(FindDebugLocTest, DifferentIterators) { EXPECT_EQ(DL1, MBB.rfindPrevDebugLoc(MI2)); EXPECT_EQ(DL1, MBB.rfindPrevDebugLoc(MI3)); EXPECT_EQ(DL1, MBB.rfindPrevDebugLoc(MBB.instr_rbegin())); + + // Finalize DIBuilder to avoid memory leaks. + DIB.finalize(); } } // end namespace