fixed regression introduced by get_additional_symbols() (memory leak)

This commit is contained in:
stefan schippers 2023-04-21 15:31:27 +02:00
parent 0102438751
commit eb6705d0f4
5 changed files with 10 additions and 7 deletions

View File

@ -1217,10 +1217,10 @@ void get_additional_symbols(int what)
static int num_syms; /* no context switch between start and end so it is safe */
Int_hashentry *found;
Int_hashtable sym_table = {NULL, 0};
int_hash_init(&sym_table, HASHSIZE);
if(what == 1) { /* start */
int_hash_init(&sym_table, HASHSIZE);
num_syms = xctx->symbols;
for(i = 0; i < xctx->symbols; ++i) {
int_hash_lookup(&sym_table, xctx->sym[i].name, i, XINSERT);
@ -1274,7 +1274,6 @@ void get_additional_symbols(int what)
}
xctx->symbols = num_syms;
}
int_hash_free(&sym_table);
}
void get_sch_from_sym(char *filename, xSymbol *sym, int inst)

View File

@ -105,7 +105,8 @@ void hier_psprint(char **res, int what) /* netlister driver */
}
}
}
get_additional_symbols(0);
/* can not free additional syms since *_block_netlist() may have loaded additional syms */
/* get_additional_symbols(0); */
my_free(_ALLOC_ID_, &abs_path);
str_hash_free(&subckt_table);
my_free(_ALLOC_ID_, &subckt_name);
@ -427,7 +428,7 @@ int global_spice_netlist(int global) /* netlister driver */
}
}
my_free(_ALLOC_ID_, &abs_path);
get_additional_symbols(0);
/* get_additional_symbols(0); */
my_free(_ALLOC_ID_, &subckt_name);
/*clear_drawing(); */
my_strncpy(xctx->sch[xctx->currsch] , "", S(xctx->sch[xctx->currsch]));

View File

@ -222,7 +222,8 @@ int global_tedax_netlist(int global) /* netlister driver */
}
}
my_free(_ALLOC_ID_, &abs_path);
get_additional_symbols(0);
/* can not free additional syms since *_block_netlist() may have loaded additional syms */
/* get_additional_symbols(0); */
str_hash_free(&subckt_table);
my_free(_ALLOC_ID_, &subckt_name);
/*clear_drawing(); */

View File

@ -375,7 +375,8 @@ int global_verilog_netlist(int global) /* netlister driver */
}
}
my_free(_ALLOC_ID_, &abs_path);
get_additional_symbols(0);
/* can not free additional syms since *_block_netlist() may have loaded additional syms */
/* get_additional_symbols(0); */
str_hash_free(&subckt_table);
my_free(_ALLOC_ID_, &subckt_name);
my_strncpy(xctx->sch[xctx->currsch] , "", S(xctx->sch[xctx->currsch]));

View File

@ -475,7 +475,8 @@ int global_vhdl_netlist(int global) /* netlister driver */
}
}
my_free(_ALLOC_ID_, &abs_path);
get_additional_symbols(0);
/* can not free additional syms since *_block_netlist() may have loaded additional syms */
/* get_additional_symbols(0); */
str_hash_free(&subckt_table);
my_free(_ALLOC_ID_, &subckt_name);
my_strncpy(xctx->sch[xctx->currsch] , "", S(xctx->sch[xctx->currsch]));