Index: trunk/src/libcschem/abstract.c =================================================================== --- trunk/src/libcschem/abstract.c (revision 10304) +++ trunk/src/libcschem/abstract.c (revision 10305) @@ -111,6 +111,7 @@ void csch_abstract_uninit(csch_abstract_t *abs) { htsp_entry_t *e; + long n; csch_hlevel_free_tree(abs->hroot); @@ -124,9 +125,15 @@ free(e->value); e->value = NULL; } + for(n = 0; n < abs->orphaned_ports.used; n++) { + csch_aport_free_fields(abs->orphaned_ports.array[n]); + free(abs->orphaned_ports.array[n]); + } + htsp_uninit(&abs->nets); htsp_uninit(&abs->comps); htip_uninit(&abs->aid2obj); + vtp0_uninit(&abs->orphaned_ports); memset(abs, 0, sizeof(csch_abstract_t)); } @@ -213,6 +220,8 @@ if (comp != NULL) htsp_set(&comp->ports, port->name, port); + else + vtp0_append(&abs->orphaned_ports, port); return port; } Index: trunk/src/libcschem/abstract.h =================================================================== --- trunk/src/libcschem/abstract.h (revision 10304) +++ trunk/src/libcschem/abstract.h (revision 10305) @@ -33,6 +33,7 @@ #include #include #include +#include #include "libcschem/common_types.h" #include "libcschem/attrib.h" @@ -63,6 +64,7 @@ htul_t uid2id; /* UID -> object id (cache) */ htsp_t nets; /* global netname -> csch_anet_t */ htsp_t comps; /* global name -> csch_acomp_t */ + vtp0_t orphaned_ports; /* ports without a component parent; typical for sheet ports in a hierarchy */ long next_aid; /* counters for unique names */