Re: [cc65] Need some help with a memory leak

From: Payton Byrd <plbyrd1gmail.com>
Date: 2010-05-05 00:46:29
I found the culprit in the memory leak situation after I refactored the code
and still had the same problem.  The issue was that not only did I need to
free currentNode, but I also first needed to free currentNode->dir_entry as
well.

This exercise has definitely reiterated my love of managed languages. :)

Final working code:

currentNode = drive->head;
 while(currentNode != NULL)
{
nextNode = currentNode->next;
 if(currentNode->dir_entry != NULL)
{
free(currentNode->dir_entry);
 }
free(currentNode);
currentNode = nextNode;
 }

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Wed May 5 00:46:56 2010

This archive was generated by hypermail 2.1.8 : 2010-05-05 00:46:58 CEST