Browse Source

CIDER: Plug small memory leaks in INPparseNumMod()

pre-master-46
Holger Vogt 3 years ago
parent
commit
3bb9cd738f
  1. 8
      src/spicelib/parser/inpgmod.c

8
src/spicelib/parser/inpgmod.c

@ -462,8 +462,10 @@ INPparseNumMod(CKTcircuit *ckt, INPmodel *model, INPtables *tab, char **errMessa
/* Add card structure to model */ /* Add card structure to model */
info = INPcardTab[lastType]; info = INPcardTab[lastType];
error = info->newCard(&tmpCard, model->INPmodfast); error = info->newCard(&tmpCard, model->INPmodfast);
if (error)
if (error) {
FREE(cardName);
return error; return error;
}
/* Handle parameter-less cards */ /* Handle parameter-less cards */
} else if (cinprefix(cardName, "title", 3)) { } else if (cinprefix(cardName, "title", 3)) {
/* Do nothing */ /* Do nothing */
@ -472,6 +474,7 @@ INPparseNumMod(CKTcircuit *ckt, INPmodel *model, INPtables *tab, char **errMessa
} else if (cinprefix(cardName, "end", 3)) { } else if (cinprefix(cardName, "end", 3)) {
/* Terminate parsing */ /* Terminate parsing */
*errMessage = err; *errMessage = err;
FREE(cardName);
return 0; return 0;
} else { } else {
/* Error */ /* Error */
@ -479,6 +482,7 @@ INPparseNumMod(CKTcircuit *ckt, INPmodel *model, INPtables *tab, char **errMessa
tprintf("Error on card %d : unrecognized name (%s) - ignored", tprintf("Error on card %d : unrecognized name (%s) - ignored",
cardNum, cardName)); cardNum, cardName));
} }
FREE(cardName);
} }
} }
@ -525,6 +529,8 @@ INPparseNumMod(CKTcircuit *ckt, INPmodel *model, INPtables *tab, char **errMessa
} }
error = info->setCardParm(info->cardParms[idx].id, value, tmpCard); error = info->setCardParm(info->cardParms[idx].id, value, tmpCard);
if (info->cardParms[idx].dataType & IF_STRING)
FREE(value->sValue);
if (error) if (error)
return error; return error;
} }

Loading…
Cancel
Save