Also in case of allocation error we have to free existing memory before return.
This commit is contained in:
parent
a6fa3aaa11
commit
d7089adcaf
|
|
@ -286,6 +286,7 @@ void cm_d_osc(ARGS)
|
|||
y = (double *) calloc((size_t) freq_size, sizeof(double));
|
||||
if (!y) {
|
||||
cm_message_send(d_osc_allocation_error);
|
||||
if(x) free(x);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -444,6 +444,8 @@ cm_table2D(ARGS) /* structure holding parms, inputs, outputs, etc. */
|
|||
cm_message_printf("Insufficient memory to read file %s", PARAM(file));
|
||||
loc->state->atend = 1;
|
||||
loc->init_err = 1;
|
||||
if(cFile) free(cFile);
|
||||
if(cThisLine) free(cThisLine);
|
||||
return;
|
||||
}
|
||||
/* read whole file into cFile */
|
||||
|
|
|
|||
|
|
@ -458,6 +458,8 @@ cm_table3D(ARGS) /* structure holding parms, inputs, outputs, etc. */
|
|||
cm_message_printf("Insufficient memory to read file %s", PARAM(file));
|
||||
loc->state->atend = 1;
|
||||
loc->init_err = 1;
|
||||
if(cFile) free(cFile);
|
||||
if(cThisLine) free(cThisLine);
|
||||
return;
|
||||
}
|
||||
/* read whole file into cFile */
|
||||
|
|
|
|||
Loading…
Reference in New Issue