From 21edfb21279dcfde7953aa46d6bcb7bd698eb273 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Mon, 27 Aug 2018 12:47:56 +0200 Subject: [PATCH] safety measure against here->conn[i]->port[j]->partial etc. being NULL --- src/xspice/mif/mifsetup.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/xspice/mif/mifsetup.c b/src/xspice/mif/mifsetup.c index 1e9983976..cfe435076 100644 --- a/src/xspice/mif/mifsetup.c +++ b/src/xspice/mif/mifsetup.c @@ -515,9 +515,12 @@ MIFunsetup(GENmodel *inModel,CKTcircuit *ckt) for (k = 0; k < num_conn; k++) { if ((here->conn[k]->is_null) || (!here->conn[k]->is_input)) continue; - tfree(here->conn[i]->port[j]->partial[k].port); - tfree(here->conn[i]->port[j]->ac_gain[k].port); - tfree(here->conn[i]->port[j]->smp_data.input[k].port); + if (here->conn[i]->port[j]->partial) + tfree(here->conn[i]->port[j]->partial[k].port); + if (here->conn[i]->port[j]->ac_gain) + tfree(here->conn[i]->port[j]->ac_gain[k].port); + if (here->conn[i]->port[j]->smp_data.input) + tfree(here->conn[i]->port[j]->smp_data.input[k].port); } tfree(here->conn[i]->port[j]->partial); tfree(here->conn[i]->port[j]->ac_gain);