summaryrefslogtreecommitdiffstats
path: root/llvm/lib/AsmParser
diff options
context:
space:
mode:
authorNuno Lopes <nunoplopes@sapo.pt>2008-11-04 14:42:19 +0000
committerNuno Lopes <nunoplopes@sapo.pt>2008-11-04 14:42:19 +0000
commit0e92081b040a13dc8f00dac182e327af56bf7838 (patch)
tree600124e6f06f9995c3b088a74cf67a4effcf359e /llvm/lib/AsmParser
parent97a9c81b05ae342ec77743a44eedb9908e8a648f (diff)
downloadbcm5719-llvm-0e92081b040a13dc8f00dac182e327af56bf7838.tar.gz
bcm5719-llvm-0e92081b040a13dc8f00dac182e327af56bf7838.zip
fix leakage of APFloats in getExistingVal()
llvm-svn: 58696
Diffstat (limited to 'llvm/lib/AsmParser')
-rw-r--r--llvm/lib/AsmParser/ParserInternals.h2
-rw-r--r--llvm/lib/AsmParser/llvmAsmParser.y6
2 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/AsmParser/ParserInternals.h b/llvm/lib/AsmParser/ParserInternals.h
index 168d9baa3a0..8af27c77c33 100644
--- a/llvm/lib/AsmParser/ParserInternals.h
+++ b/llvm/lib/AsmParser/ParserInternals.h
@@ -152,6 +152,8 @@ struct ValID {
delete IAD;
else if (Type == ConstAPInt)
delete ConstPoolInt;
+ else if (Type == ConstFPVal)
+ delete ConstPoolFP;
}
inline ValID copy() const {
diff --git a/llvm/lib/AsmParser/llvmAsmParser.y b/llvm/lib/AsmParser/llvmAsmParser.y
index d76994a431a..36b827d6b72 100644
--- a/llvm/lib/AsmParser/llvmAsmParser.y
+++ b/llvm/lib/AsmParser/llvmAsmParser.y
@@ -437,7 +437,11 @@ static Value *getExistingVal(const Type *Ty, const ValID &D) {
D.ConstPoolFP->convert(APFloat::IEEEsingle, APFloat::rmNearestTiesToEven,
&ignored);
}
- return ConstantFP::get(*D.ConstPoolFP);
+ {
+ ConstantFP *tmp = ConstantFP::get(*D.ConstPoolFP);
+ D.destroy();
+ return tmp;
+ }
case ValID::ConstNullVal: // Is it a null value?
if (!isa<PointerType>(Ty)) {
OpenPOWER on IntegriCloud