|
|
@ -304,6 +304,8 @@ cm_table3D_callback(ARGS, Mif_Callback_Reason_t reason) |
|
|
case MIF_CB_DESTROY: { |
|
|
case MIF_CB_DESTROY: { |
|
|
int i, j; |
|
|
int i, j; |
|
|
Local_Data_t *loc = STATIC_VAR (locdata); |
|
|
Local_Data_t *loc = STATIC_VAR (locdata); |
|
|
|
|
|
if (!loc) |
|
|
|
|
|
break; |
|
|
free(loc->state); |
|
|
free(loc->state); |
|
|
|
|
|
|
|
|
for (i = 0; i < loc->iz; i++) { |
|
|
for (i = 0; i < loc->iz; i++) { |
|
|
@ -317,6 +319,7 @@ cm_table3D_callback(ARGS, Mif_Callback_Reason_t reason) |
|
|
free(loc->zcol); |
|
|
free(loc->zcol); |
|
|
sf_eno3_close (loc->newtable); |
|
|
sf_eno3_close (loc->newtable); |
|
|
free(loc); |
|
|
free(loc); |
|
|
|
|
|
STATIC_VAR (locdata) = loc = NULL; |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -442,8 +445,9 @@ cm_table3D(ARGS) /* structure holding parms, inputs, outputs, etc. */ |
|
|
struct stat st; |
|
|
struct stat st; |
|
|
if (!loc->state->fp || fstat(fileno(loc->state->fp), &st)) { |
|
|
if (!loc->state->fp || fstat(fileno(loc->state->fp), &st)) { |
|
|
cm_message_printf("cannot open file %s", PARAM(file)); |
|
|
cm_message_printf("cannot open file %s", PARAM(file)); |
|
|
loc->state->atend = 1; |
|
|
|
|
|
loc->init_err = 1; |
|
|
|
|
|
|
|
|
free(loc->state); |
|
|
|
|
|
free(loc); |
|
|
|
|
|
STATIC_VAR (locdata) = loc = NULL; |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
/* get file length */ |
|
|
/* get file length */ |
|
|
@ -455,8 +459,9 @@ cm_table3D(ARGS) /* structure holding parms, inputs, outputs, etc. */ |
|
|
cThisLine = calloc(lFileLen + 1, sizeof(char)); |
|
|
cThisLine = calloc(lFileLen + 1, sizeof(char)); |
|
|
if (cFile == NULL || cThisLine == NULL) { |
|
|
if (cFile == NULL || cThisLine == NULL) { |
|
|
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->init_err = 1; |
|
|
|
|
|
|
|
|
free(loc->state); |
|
|
|
|
|
free(loc); |
|
|
|
|
|
STATIC_VAR (locdata) = loc = NULL; |
|
|
if(cFile) free(cFile); |
|
|
if(cFile) free(cFile); |
|
|
if(cThisLine) free(cThisLine); |
|
|
if(cThisLine) free(cThisLine); |
|
|
return; |
|
|
return; |
|
|
@ -668,7 +673,7 @@ cm_table3D(ARGS) /* structure holding parms, inputs, outputs, etc. */ |
|
|
loc = STATIC_VAR (locdata); |
|
|
loc = STATIC_VAR (locdata); |
|
|
|
|
|
|
|
|
/* return immediately if there was an initialization error */ |
|
|
/* return immediately if there was an initialization error */ |
|
|
if (loc->init_err == 1) |
|
|
|
|
|
|
|
|
if (!loc || loc->init_err == 1) |
|
|
return; |
|
|
return; |
|
|
|
|
|
|
|
|
/* get input x, y, z; |
|
|
/* get input x, y, z; |
|
|
|