Debugger: More memory management fixes.

DwarfImageDebugInfo:
- Type name/info entries weren't being freed properly.

BaseUnit:
- The array of entries itself was being destroyed, but not the actual
  objects. Consequently none of the DIE objects were ever being freed.

CfaRuleSet:
- The register rules array wasn't being freed.

FileManager:
- References to entries weren't being released. Some more work remains to be
  done here though, as a subset of these objects still have a non-zero ref
  count in the end.
This commit is contained in:
Rene Gollent 2017-12-31 17:48:28 -05:00
parent 8a9e1e0d4a
commit b1ab02c434
5 changed files with 25 additions and 1 deletions

View File

@ -267,7 +267,7 @@ struct DwarfImageDebugInfo::TypeNameEntry : TypeNameKey {
TypeNameEntry(const BString& name)
:
TypeNameKey(name),
types(10, false)
types(10, true)
{
}
@ -362,6 +362,12 @@ DwarfImageDebugInfo::~DwarfImageDebugInfo()
fFile->ReleaseReference();
fTypeCache->ReleaseReference();
TypeNameEntry* entry = fTypeNameTable->Clear(true);
while (entry != NULL) {
TypeNameEntry* next = entry->next;
delete entry;
entry = next;
}
delete fTypeNameTable;
}

View File

@ -29,6 +29,8 @@ BaseUnit::BaseUnit(off_t headerOffset, off_t contentOffset,
BaseUnit::~BaseUnit()
{
for (int32 i = 0; i < fEntries.Count(); i++)
delete fEntries[i];
}

View File

@ -19,6 +19,12 @@ CfaRuleSet::CfaRuleSet()
}
CfaRuleSet::~CfaRuleSet()
{
delete[] fRegisterRules;
}
status_t
CfaRuleSet::Init(uint32 registerCount)
{

View File

@ -12,6 +12,7 @@
class CfaRuleSet {
public:
CfaRuleSet();
~CfaRuleSet();
status_t Init(uint32 registerCount);
CfaRuleSet* Clone() const;

View File

@ -124,6 +124,9 @@ public:
entry->ReleaseReference();
entry = next;
}
while ((entry = fDeadEntries.RemoveHead()) != NULL)
entry->ReleaseReference();
}
status_t Init()
@ -208,6 +211,12 @@ private:
}
}
}
LocatableDirectory* parent = entry->Parent();
if (parent != NULL)
parent->RemoveEntry(entry);
delete entry;
}
bool _LocateDirectory(LocatableDirectory* directory,