Browse Source

Also in case of allocation error we have to free existing memory before return.

pre-master-46
dwarning 7 years ago
committed by Holger Vogt
parent
commit
d7089adcaf
  1. 1
      src/xspice/icm/digital/d_osc/cfunc.mod
  2. 2
      src/xspice/icm/table/table2D/cfunc.mod
  3. 2
      src/xspice/icm/table/table3D/cfunc.mod

1
src/xspice/icm/digital/d_osc/cfunc.mod

@ -286,6 +286,7 @@ void cm_d_osc(ARGS)
y = (double *) calloc((size_t) freq_size, sizeof(double)); y = (double *) calloc((size_t) freq_size, sizeof(double));
if (!y) { if (!y) {
cm_message_send(d_osc_allocation_error); cm_message_send(d_osc_allocation_error);
if(x) free(x);
return; return;
} }

2
src/xspice/icm/table/table2D/cfunc.mod

@ -444,6 +444,8 @@ cm_table2D(ARGS) /* structure holding parms, inputs, outputs, etc. */
cm_message_printf("Insufficient memory to read file %s", PARAM(file)); cm_message_printf("Insufficient memory to read file %s", PARAM(file));
loc->state->atend = 1; loc->state->atend = 1;
loc->init_err = 1; loc->init_err = 1;
if(cFile) free(cFile);
if(cThisLine) free(cThisLine);
return; return;
} }
/* read whole file into cFile */ /* read whole file into cFile */

2
src/xspice/icm/table/table3D/cfunc.mod

@ -458,6 +458,8 @@ cm_table3D(ARGS) /* structure holding parms, inputs, outputs, etc. */
cm_message_printf("Insufficient memory to read file %s", PARAM(file)); cm_message_printf("Insufficient memory to read file %s", PARAM(file));
loc->state->atend = 1; loc->state->atend = 1;
loc->init_err = 1; loc->init_err = 1;
if(cFile) free(cFile);
if(cThisLine) free(cThisLine);
return; return;
} }
/* read whole file into cFile */ /* read whole file into cFile */

Loading…
Cancel
Save