Index: trunk/src/plug_io.c =================================================================== --- trunk/src/plug_io.c (revision 31261) +++ trunk/src/plug_io.c (revision 31262) @@ -297,7 +297,8 @@ skip:; if (subfpname_reset) { fctx.subfpname = NULL; - TODO("free map"); + if (map != NULL) + pcb_io_fp_map_free(map); } } @@ -1099,6 +1100,32 @@ } } +static void pcb_io_fp_map_free_fields(pcb_plug_fp_map_t *m) +{ + long n; + for(n = 0; n < m->tags.used; n++) + free(m->tags.array[n]); + vts0_uninit(&m->tags); + free(m->name); + m->name = NULL; + m->type = 0; + m->libtype = 0; +} + +void pcb_io_fp_map_free(pcb_plug_fp_map_t *head) +{ + pcb_plug_fp_map_t *m, *next; + + pcb_io_fp_map_free_fields(head); + + for(m = head->next; m != NULL; m = next) { + next = m->next; + pcb_io_fp_map_free_fields(m); + free(m); + } +} + + void pcb_io_uninit(void) { pcb_view_list_free_fields(&pcb_io_incompat_lst); Index: trunk/src/plug_io.h =================================================================== --- trunk/src/plug_io.h (revision 31261) +++ trunk/src/plug_io.h (revision 31262) @@ -158,7 +158,10 @@ the head item is converted into a footprint library */ void pcb_io_fp_map_append(pcb_plug_fp_map_t **tail, pcb_plug_fp_map_t *head, const char *filename, const char *fpname); +/* Free a map with a statically allocated head */ +void pcb_io_fp_map_free(pcb_plug_fp_map_t *head); + /********** common function used to be part of file.[ch] and friends **********/ int pcb_save_pcb(const char *, const char *fmt); #define PCB_INHIBIT_BOARD_CHANGED 0x20