Skip to content

Commit d02112b

Browse files
committed
Fix a valgrind uninitialized conditional error in cosp
The modified line was causing this error: ==19971== Conditional jump or move depends on uninitialised value(s) ==19971== at 0xA47583: __mod_cosp_MOD_cosp_simulator (cosp.F90:502) ... when cospOUT%isccp_meantb is not allocated. I noticed all surrounding accesses of members of cospOUT were guarded by association checks, so I added that check.
1 parent 9d910ac commit d02112b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/cosp.F90

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ function COSP_SIMULATOR(cospIN,cospgridIN,cospOUT,start_idx,stop_idx,debug)
499499
Lrttov_column = .true.
500500

501501
! Set flag to deallocate rttov types (only done on final call to simulator)
502-
if (size(cospOUT%isccp_meantb) .eq. stop_idx) lrttov_cleanUp = .true.
502+
if (associated(cospOUT%isccp_meantb) .and. size(cospOUT%isccp_meantb) .eq. stop_idx) lrttov_cleanUp = .true.
503503

504504
! ISCCP column
505505
if (associated(cospOUT%isccp_fq) .or. &

0 commit comments

Comments
 (0)