aboutsummaryrefslogtreecommitdiffstats
path: root/lib/AsmParser
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-03-08 18:57:56 +0000
committerChris Lattner <sabre@nondot.org>2002-03-08 18:57:56 +0000
commit9176fe41710c9654ace37936e9fa88a8f5aae0c4 (patch)
tree5cdd017db5b18e19449160273e2cc58fb1ee5615 /lib/AsmParser
parentf28d6c9313755804cf88ae507699942af7a1528f (diff)
downloadexternal_llvm-9176fe41710c9654ace37936e9fa88a8f5aae0c4.zip
external_llvm-9176fe41710c9654ace37936e9fa88a8f5aae0c4.tar.gz
external_llvm-9176fe41710c9654ace37936e9fa88a8f5aae0c4.tar.bz2
Fix minor memory leak
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1837 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AsmParser')
-rw-r--r--lib/AsmParser/llvmAsmParser.y6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y
index fb024ed..9d6c99d 100644
--- a/lib/AsmParser/llvmAsmParser.y
+++ b/lib/AsmParser/llvmAsmParser.y
@@ -1210,6 +1210,12 @@ MethodHeaderH : OptInternal TypesV STRINGCONSTANT '(' ArgList ')' {
ArgList.push_back(I->first);
}
delete $5; // We're now done with the argument list
+ } else if ($5) {
+ // If we are a declaration, we should free the memory for the argument list!
+ for (list<pair<MethodArgument*, char*> >::iterator I = $5->begin();
+ I != $5->end(); ++I)
+ if (I->second) free(I->second); // Free the memory for the name...
+ delete $5; // Free the memory for the list itself
}
}