Browse Source

Fix a bug when deleting the memory. With the first call

to mem_delete() all the hash table is deleted, a second
call to mem_delete() does not have any further effect, so
has to be avoided.
pre-master-46
Holger Vogt 2 years ago
parent
commit
10756111bf
  1. 3
      src/spicelib/devices/cpl/cplhash.c

3
src/spicelib/devices/cpl/cplhash.c

@ -126,6 +126,8 @@ void my_key_free(void * key)
void mem_delete(void) {
#ifdef DB
char buf[128];
if (!memory_table)
return;
printf("CPL GC memory allocated %d times, freed %d times\n", mem_in, mem_out);
printf("CPL GC size of hash table to be freed: %d entries.\n", nghash_get_size(memory_table));
#ifdef DB_FULL
@ -142,6 +144,7 @@ void mem_delete(void) {
#endif
gc_is_on = 0;
nghash_free(memory_table, NULL, my_key_free);
memory_table = NULL;
#ifdef DB
/* printf via sh_printf will need some info from variables that have
been deleted already, therefore we use fputs */

Loading…
Cancel
Save