Fixed a rather large memory leak.
git-svn-id: svn://svn.cc65.org/cc65/trunk@5102 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -72,6 +72,15 @@ static CodeRange* NewCodeRange (Segment* Seg, unsigned long Offs, unsigned long
|
||||
|
||||
|
||||
|
||||
static void FreeCodeRange (CodeRange* R)
|
||||
/* Free a CodeRange structure */
|
||||
{
|
||||
/* Just free the memory */
|
||||
xfree (R);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static LineInfo* NewLineInfo (void)
|
||||
/* Create and return a new LineInfo struct with mostly empty fields */
|
||||
{
|
||||
@@ -93,6 +102,30 @@ static LineInfo* NewLineInfo (void)
|
||||
|
||||
|
||||
|
||||
void FreeLineInfo (LineInfo* LI)
|
||||
/* Free a LineInfo structure. This function will not handle a non empty
|
||||
* Fragments collection, it can only be used to free incomplete line infos.
|
||||
*/
|
||||
{
|
||||
unsigned I;
|
||||
|
||||
/* Check, check, ... */
|
||||
PRECONDITION (CollCount (&LI->Fragments) == 0);
|
||||
|
||||
/* Free all the code ranges */
|
||||
for (I = 0; I < CollCount (&LI->CodeRanges); ++I) {
|
||||
FreeCodeRange (CollAtUnchecked (&LI->CodeRanges, I));
|
||||
}
|
||||
|
||||
/* Free the collections */
|
||||
DoneCollection (&LI->CodeRanges);
|
||||
|
||||
/* Free the structure itself */
|
||||
xfree (LI);
|
||||
}
|
||||
|
||||
|
||||
|
||||
LineInfo* GenLineInfo (const FilePos* Pos)
|
||||
/* Generate a new (internally used) line info with the given information */
|
||||
{
|
||||
@@ -245,4 +278,4 @@ void RelocLineInfo (Segment* S)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user