From cd9b9aa966426fc84a9629a77a9e7b7851d09a73 Mon Sep 17 00:00:00 2001 From: Jonathan Moussa Date: Sun, 17 Nov 2024 10:56:48 -0500 Subject: [PATCH] Delay null file handle closure until after post-processing --- src/interface/mopac_api_finalize.F90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/interface/mopac_api_finalize.F90 b/src/interface/mopac_api_finalize.F90 index 61e5a538..38df9b08 100644 --- a/src/interface/mopac_api_finalize.F90 +++ b/src/interface/mopac_api_finalize.F90 @@ -50,12 +50,12 @@ module subroutine mopac_finalize(properties) integer :: status, i, j, size type(c_ptr), allocatable :: pptr(:) - ! close dummy output file to free up /dev/null - close(iw) - ! record properties if (.not. moperr) call mopac_record(properties) + ! close dummy output file to free up /dev/null + close(iw) + ! collect error messages & assign NULL pointers for memory safety if (moperr) then properties%charge = c_null_ptr