From ae3e4b75156f7cdbfa71fc4b737e4ef08234ca32 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Wed, 21 Feb 2018 19:55:11 +0000 Subject: [PATCH] Fix a memory leak and a cross module reference. llvm-svn: 325712 --- tools/llvm-c-test/echo.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/llvm-c-test/echo.cpp b/tools/llvm-c-test/echo.cpp index db7211a3eab..c372e11ad2a 100644 --- a/tools/llvm-c-test/echo.cpp +++ b/tools/llvm-c-test/echo.cpp @@ -438,7 +438,7 @@ struct FunCloner { LLVMBasicBlockRef ElseBB = DeclareBB(LLVMValueAsBasicBlock(Else)); LLVMValueRef Then = LLVMGetOperand(Src, 2); LLVMBasicBlockRef ThenBB = DeclareBB(LLVMValueAsBasicBlock(Then)); - Dst = LLVMBuildCondBr(Builder, Cond, ThenBB, ElseBB); + Dst = LLVMBuildCondBr(Builder, CloneValue(Cond), ThenBB, ElseBB); break; } case LLVMSwitch: @@ -949,6 +949,7 @@ int llvm_echo(void) { fputs(Str, stdout); LLVMDisposeMessage(Str); + LLVMDisposeModule(Src); LLVMDisposeModule(M); LLVMContextDispose(Ctx);