Browse Source

Make DEVNUM robust against double initialization.

pre-master-46
Holger Vogt 7 years ago
parent
commit
33985ae1e5
  1. 5
      src/spicelib/devices/dev.c

5
src/spicelib/devices/dev.c

@ -244,6 +244,7 @@ spice_destroy_devices(void)
tfree(DEVicesfl); tfree(DEVicesfl);
#endif #endif
tfree(DEVices); tfree(DEVices);
DEVNUM = 0;
} }
@ -251,9 +252,11 @@ void
spice_init_devices(void) spice_init_devices(void)
{ {
int i; int i;
/* Safeguard against double initialization */
DEVNUM = NUMELEMS(static_devices);
#ifdef XSPICE #ifdef XSPICE
/*Initilise the structs and add digital node type */
/* Initialize the structs and add digital node type */
g_evt_udn_info = TMALLOC(Evt_Udn_Info_t *, 1); g_evt_udn_info = TMALLOC(Evt_Udn_Info_t *, 1);
g_evt_num_udn_types = 1; g_evt_num_udn_types = 1;
g_evt_udn_info[0] = &idn_digital_info; g_evt_udn_info[0] = &idn_digital_info;

Loading…
Cancel
Save