Removed several memory leaks.

git-svn-id: svn://svn.cc65.org/cc65/trunk@5595 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz
2012-03-10 21:46:09 +00:00
parent 4c36a39814
commit 84d90343ea
5 changed files with 45 additions and 7 deletions

View File

@@ -87,6 +87,18 @@ Attr* NewAttr (const char* Name, const char* Value)
void FreeAttr (Attr* A)
/* Free an attribute structure */
{
/* Allow NULL pointers */
if (A) {
xfree (A->Name);
xfree (A);
}
}
void DumpAttrColl (const Collection* C)
/* Dump a collection of attribute/value pairs for debugging */
{
@@ -240,7 +252,7 @@ void SplitAddAttr (Collection* C, const char* Combined, const char* Name)
/* Release memory */
SB_Done (&N);
}
}
}
@@ -296,3 +308,19 @@ Collection* ParseAttrList (const char* List, const char** NameList, unsigned Nam
void FreeAttrList (Collection* C)
/* Free a list of attributes */
{
unsigned I;
/* Walk over the collection and free all attributes */
for (I = 0; I < CollCount (C); ++I) {
FreeAttr (CollAtUnchecked (C, I));
}
/* Free the collection itself */
FreeCollection (C);
}