fix a small memory leak in spice_netlist.c

This commit is contained in:
stefan schippers 2023-11-21 10:48:56 +01:00
parent 8d155af82f
commit eb6f9f1f4e
2 changed files with 13 additions and 5 deletions

View File

@ -4804,19 +4804,27 @@ int xschem(ClientData clientdata, Tcl_Interp *interp, int argc, const char * arg
draw();
del_object_table();
Tcl_ResetResult(interp);
}
else if(argc > 2 && atoi(argv[2]) == 2) {
copy_hierarchy_data(".drw", ".x1.drw");
Tcl_ResetResult(interp);
}
else if(argc > 2 && atoi(argv[2]) == 3) {
Xschem_ctx **save_xctx = get_save_xctx();
save_xctx[1]->raw = save_xctx[0]->raw;
Tcl_ResetResult(interp);
}
else if(argc > 4 && atoi(argv[2]) == 4) {
raw_read(argv[3], &xctx->raw, argv[4]);
xctx->raw->level = 0;
else if(argc > 2 && atoi(argv[2]) == 4) {
Xschem_ctx **save_xctx = get_save_xctx();
save_xctx[1]->raw = NULL;
Tcl_ResetResult(interp);
}
else if(argc > 2 && atoi(argv[2]) == 5) {
Xschem_ctx **save_xctx = get_save_xctx();
Tcl_SetResult(interp, save_xctx[1]->raw == NULL ? "null" : "not null", TCL_VOLATILE);
}
Tcl_ResetResult(interp);
}
/* text x y rot flip text props size draw

View File

@ -326,8 +326,8 @@ int global_spice_netlist(int global) /* netlister driver */
found_top_symbol = 1;
}
remove_symbol(xctx->symbols - 1);
my_free(_ALLOC_ID_, &top_symbol_name);
}
my_free(_ALLOC_ID_, &top_symbol_name);
if(!found_top_symbol) {
for(i=0;i<xctx->instances; ++i) {
if(skip_instance(i, 1, lvs_ignore)) continue;