Fix massive resource leaks in the bytecode reader. Reading a bytecode file

with ParseBytecodeFile used to leak both a ModuleProvider (and related
bytecode parser stuff attached to it) AND a file descriptor, which was
never closed.  This prevented gccld/llvm-ld/llvm-link from linking together
apps with more that ~252 .bc files on darwin.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30912 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2006-10-12 18:32:30 +00:00
parent 65d8c1e8d4
commit f0edc6c18b
2 changed files with 46 additions and 45 deletions

View File

@ -248,6 +248,12 @@ protected:
/// @brief Parse a string constants block
void ParseStringConstants(unsigned NumEntries, ValueTable &Tab);
/// @brief Release our memory.
void freeState() {
freeTable(FunctionValues);
freeTable(ModuleValues);
}
/// @}
/// @name Data
/// @{
@ -467,12 +473,6 @@ private:
/// given constant.
void ResolveReferencesToConstant(Constant *C, unsigned Typ, unsigned Slot);
/// @brief Release our memory.
void freeState() {
freeTable(FunctionValues);
freeTable(ModuleValues);
}
/// @brief Free a table, making sure to free the ValueList in the table.
void freeTable(ValueTable &Tab) {
while (!Tab.empty()) {