Browse Source

Fix a memory leak reported by Brian Taylor that was introduced

by commit 4d8e17487b.
pre-master-46
Giles Atkinson 3 years ago
committed by Holger Vogt
parent
commit
98333ee89a
  1. 11
      src/xspice/mif/mifdelete.c

11
src/xspice/mif/mifdelete.c

@ -43,6 +43,7 @@ NON-STANDARD FEATURES
#include "ngspice/mifproto.h" #include "ngspice/mifproto.h"
#include "ngspice/mifdefs.h" #include "ngspice/mifdefs.h"
#include "ngspice/evt.h"
#if defined(_MSC_VER) || defined(__MINGW32__) #if defined(_MSC_VER) || defined(__MINGW32__)
#include "ngspice/mifparse.h" #include "ngspice/mifparse.h"
@ -134,8 +135,16 @@ MIFdelete(GENinstance *gen_inst)
/* Free the basic port structure allocated in MIFget_port */ /* Free the basic port structure allocated in MIFget_port */
num_port = here->conn[i]->size; num_port = here->conn[i]->size;
for (j = 0; j < num_port; j++) { for (j = 0; j < num_port; j++) {
/* Memory allocated in mif_inp2.c */
Evt_Output_Event_t *evt;
/* Memory allocated in mif_inp2.c and evtload.c. */
FREE(here->conn[i]->port[j]->type_str); FREE(here->conn[i]->port[j]->type_str);
evt = here->conn[i]->port[j]->next_event;
if (evt) {
FREE(evt->value);
FREE(evt);
}
FREE(here->conn[i]->port[j]); FREE(here->conn[i]->port[j]);
} }
FREE(here->conn[i]->port); FREE(here->conn[i]->port);

Loading…
Cancel
Save