Skip to content

Commit c19763f

Browse files
Merge pull request #562 from jacobwilliams/561-json-file-destroy
2 parents 99106c0 + 42f5649 commit c19763f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/json_file_module.F90

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,6 +849,7 @@ subroutine json_file_load(me, filename, unit)
849849
!! (if not present, a newunit
850850
!! is used)
851851

852+
call me%destroy()
852853
call me%core%load(file=filename, p=me%p, unit=unit)
853854

854855
end subroutine json_file_load
@@ -875,6 +876,7 @@ subroutine json_file_load_from_string(me, str)
875876
class(json_file),intent(inout) :: me
876877
character(kind=CK,len=*),intent(in) :: str !! string to load JSON data from
877878

879+
call me%destroy()
878880
call me%core%deserialize(me%p, str)
879881

880882
end subroutine json_file_load_from_string
@@ -1997,7 +1999,7 @@ subroutine json_file_add(me,p,destroy_original)
19971999
destroy = .true. ! default
19982000
end if
19992001

2000-
if (destroy) call me%core%destroy(me%p)
2002+
if (destroy) call me%destroy()
20012003

20022004
me%p => p
20032005

0 commit comments

Comments
 (0)