Skip to content

Commit e4a5e58

Browse files
authored
make sure variables are allocated before deallocating (#480)
1 parent 1b8920c commit e4a5e58

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

mediator/med_io_mod.F90

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1086,7 +1086,15 @@ subroutine med_io_write_FB(io_file, FB, whead, wdata, nx, ny, nt, &
10861086
call pio_syncfile(io_file)
10871087
call pio_freedecomp(io_file, iodesc)
10881088
endif
1089-
deallocate(ownedElemCoords, ownedElemCoords_x, ownedElemCoords_y)
1089+
if(allocated(ownedElemCoords)) then
1090+
deallocate(ownedElemCoords)
1091+
endif
1092+
if(allocated(ownedElemCoords_x)) then
1093+
deallocate(ownedElemCoords_x)
1094+
endif
1095+
if(allocated(ownedElemCoords_y)) then
1096+
deallocate(ownedElemCoords_y)
1097+
endif
10901098

10911099
if (dbug_flag > 5) then
10921100
call ESMF_LogWrite(trim(subname)//": done", ESMF_LOGMSG_INFO)

0 commit comments

Comments
 (0)