Index: trunk/src/libcschem/compile.c =================================================================== --- trunk/src/libcschem/compile.c (revision 10303) +++ trunk/src/libcschem/compile.c (revision 10304) @@ -286,10 +286,8 @@ if (comp == NULL) comp = csch_acomp_new(dst, hpath->hlev, scope, name_glob, name_loc); - if (comp == NULL) { - csch_eng_free_namemod(&name_glob, &name_loc); + if (comp == NULL) return -1; - } csch_compile_add_source(src, &comp->hdr); @@ -304,7 +302,6 @@ for(e = htip_first(&src->id2obj); e != NULL; e = htip_next(&src->id2obj, e)) compile_port(dst, viewid, hpath, sheet, comp, e->value, 0); - csch_eng_free_namemod(&name_glob, &name_loc); return res; } @@ -467,7 +464,7 @@ char *name_glob = NULL, *name_loc = NULL; const csch_attrib_t *aname = NULL; csch_sheet_t *child = NULL; - int hres; + int hres, cres; csch_ascope_t scope = CSCH_ASCOPE_unknown; hres = csch_hier_find_sym_child(sheet, src, &child, 0); @@ -500,6 +497,7 @@ &name_glob, &name_loc, orig_name, FGW_COBJ, src, FGW_HPATH, hpath, FGW_INVALID); if (name_glob == NULL) { + csch_eng_free_namemod(&name_glob, &name_loc); rnd_message(RND_MSG_ERROR, "Internal error: failed to perform symbol name translation\n"); return -1; } @@ -506,9 +504,13 @@ if (hres == 1) - return compile_symbol_child_sheet(dst, viewid, hpath, scope, sheet, src, name_glob, name_loc, orig_name, child); + cres = compile_symbol_child_sheet(dst, viewid, hpath, scope, sheet, src, name_glob, name_loc, orig_name, child); + else + cres = compile_symbol_to_component(dst, viewid, hpath, scope, sheet, src, name_glob, name_loc, orig_name); - return compile_symbol_to_component(dst, viewid, hpath, scope, sheet, src, name_glob, name_loc, orig_name); + csch_eng_free_namemod(&name_glob, &name_loc); + + return cres; } int csch_compile_connect_net_to(csch_anet_t **net, csch_ahdr_t *a, int allow_reconn)