Index: trunk/src/mymem.c =================================================================== --- trunk/src/mymem.c (revision 1257) +++ trunk/src/mymem.c (revision 1258) @@ -610,6 +610,7 @@ free(pcb->Name); free(pcb->Filename); free(pcb->PrintFilename); + rats_patch_destroy(pcb); FreeDataMemory(pcb->Data); free(pcb->Data); /* release font symbols */ Index: trunk/src/rats_patch.c =================================================================== --- trunk/src/rats_patch.c (revision 1257) +++ trunk/src/rats_patch.c (revision 1258) @@ -74,6 +74,16 @@ n->next = NULL; } +void rats_patch_destroy(PCBTypePtr pcb) +{ + rats_patch_line_t *n, *next; + + for(n = pcb->NetlistPatches; n != NULL; n = next) { + next = n->next; + free(n); + } +} + void rats_patch_append_optimize(PCBTypePtr pcb, rats_patch_op_t op, const char *id, const char *a1, const char *a2) { rats_patch_op_t seek_op; Index: trunk/src/rats_patch.h =================================================================== --- trunk/src/rats_patch.h (revision 1257) +++ trunk/src/rats_patch.h (revision 1258) @@ -37,6 +37,9 @@ /* Allocate and append a patch line to the patch list */ void rats_patch_append(PCBTypePtr pcb, rats_patch_op_t op, const char *id, const char *a1, const char *a2); +/* Free the patch list and all memory claimed by patch list items */ +void rats_patch_destroy(PCBTypePtr pcb); + /* Same as rats_patch_append() but also optimize previous entries so that redundant entries are removed */ void rats_patch_append_optimize(PCBTypePtr pcb, rats_patch_op_t op, const char *id, const char *a1, const char *a2);