From 539932f03d3aae652ad7a5debc62291f92595810 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Fri, 9 Apr 2021 13:06:32 +0100 Subject: [PATCH] Examples: Fix memory leaks and clean up comments --- examples/F90/bufr_read_tempf.f90 | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/examples/F90/bufr_read_tempf.f90 b/examples/F90/bufr_read_tempf.f90 index 66abf7526..4851bd4ce 100644 --- a/examples/F90/bufr_read_tempf.f90 +++ b/examples/F90/bufr_read_tempf.f90 @@ -17,7 +17,7 @@ ! below might not work directly for other types of TEMP messages than the one used in the ! example. It is advised to use bufr_dump first to understand the structure of these messages. ! -program bufr_read_temp +program bufr_read_tempf use eccodes implicit none integer :: ifile @@ -44,11 +44,11 @@ program bufr_read_temp call codes_open_file(ifile, '../../data/bufr/PraticaTemp.bufr', 'r') - ! the first bufr message is loaded from file - ! ibufr is the bufr id to be used in subsequent calls + ! the first BUFR message is loaded from file + ! ibufr is the BUFR id to be used in subsequent calls call codes_bufr_new_from_file(ifile, ibufr, iret) - ! do while (iret/=CODES_END_OF_FILE) + ! loop through all messages in the file do while (iret /= CODES_END_OF_FILE .AND. status_time == CODES_SUCCESS) ! we need to instruct ecCodes to expand all the descriptors @@ -57,7 +57,6 @@ program bufr_read_temp ! In our BUFR message verticalSoundingSignificance is always followed by ! geopotential, airTemperature, dewpointTemperature, ! windDirection, windSpeed and pressure. - ! count = count + 1 llskip = .False. @@ -157,21 +156,21 @@ program bufr_read_temp wdirVal(i), wspVal(i), INT(vssVal(i)), Note end do - ! free arrays + ! free allocated arrays deallocate (dlatVal, dlonVal, vssVal) deallocate (presVal, zVal, tVal, tdVal, wdirVal, wspVal) + deallocate (lat, lon) END IF IF (ALLOCATED(timeVal)) deallocate (timeVal) - ! release the bufr message + ! release the BUFR message call codes_release(ibufr) - ! load the next bufr message + ! load the next BUFR message call codes_bufr_new_from_file(ifile, ibufr, iret) end do - ! close file call codes_close_file(ifile) -end program bufr_read_temp +end program bufr_read_tempf