Fix memory leak I introduced in 2d66ed370a

This should fix the asan issue identified on the Linux asan bot.
This commit is contained in:
Chris Bieneman 2022-01-31 19:44:37 -06:00
parent 275c56226d
commit 4f710515fb
1 changed files with 5 additions and 1 deletions

View File

@ -19,6 +19,7 @@ class PassBuilderCTest : public testing::Test {
char *Triple = LLVMGetDefaultTargetTriple();
if (strlen(Triple) == 0) {
GTEST_SKIP();
LLVMDisposeMessage(Triple);
return;
}
LLVMInitializeAllTargetInfos();
@ -38,8 +39,11 @@ class PassBuilderCTest : public testing::Test {
void TearDown() override {
char *Triple = LLVMGetDefaultTargetTriple();
if (strlen(Triple) == 0)
if (strlen(Triple) == 0) {
LLVMDisposeMessage(Triple);
return; // Skipped, so nothing to tear down
}
LLVMDisposeMessage(Triple);
LLVMDisposeTargetMachine(TM);
LLVMDisposeModule(Module);
LLVMContextDispose(Context);