Update to callback function:

delete memory also in the eno structure
do not close a file twice
This commit is contained in:
Holger Vogt 2018-08-11 00:43:54 +02:00
parent 7e611e7b57
commit c891c2f64f
2 changed files with 2 additions and 4 deletions

View File

@ -299,12 +299,11 @@ cm_table2D_callback(ARGS, Mif_Callback_Reason_t reason)
case MIF_CB_DESTROY: {
int i;
Local_Data_t *loc = STATIC_VAR (locdata);
if (loc->state->fp)
fclose(loc->state->fp);
free(loc->state);
for (i = 0; i < loc->iy; i++)
free(loc->table[i]);
free(loc->table);
sf_eno2_close (loc->newtable);
free(loc);
break;
}

View File

@ -305,8 +305,6 @@ cm_table3D_callback(ARGS, Mif_Callback_Reason_t reason)
case MIF_CB_DESTROY: {
int i, j;
Local_Data_t *loc = STATIC_VAR (locdata);
if (loc->state->fp)
fclose(loc->state->fp);
free(loc->state);
for (i = 0; i < loc->iz; i++) {
@ -315,6 +313,7 @@ cm_table3D_callback(ARGS, Mif_Callback_Reason_t reason)
free(loc->table[i]);
}
free(loc->table);
sf_eno3_close (loc->newtable);
free(loc);
break;
}