From daee2b492fdf706697429f036b37a46ecc84c2fc Mon Sep 17 00:00:00 2001 From: "Vikram S. Adve" Date: Wed, 2 Jul 2003 01:25:44 +0000 Subject: [PATCH] Leak fix: delete old objects before reallocation in an assignment operator! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7055 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/CodeGen/MachineInstr.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/llvm/CodeGen/MachineInstr.h b/include/llvm/CodeGen/MachineInstr.h index 721b513c747..9bc59f3ff41 100644 --- a/include/llvm/CodeGen/MachineInstr.h +++ b/include/llvm/CodeGen/MachineInstr.h @@ -190,6 +190,8 @@ public: } const MachineOperand &operator=(const MachineOperand &MO) { + if (isExternalSymbol()) // if old operand had a symbol name, + delete SymbolName; // release old memory immedVal = MO.immedVal; flags = MO.flags; opType = MO.opType;