Skip to content

Commit 23d98f6

Browse files
committed
fixed another memory leak in unit test
1 parent 2f9495e commit 23d98f6

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/tests/jf_test_35.F90

+6-7
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ subroutine test_35(error_cnt)
2323
integer,intent(out) :: error_cnt
2424

2525
type(json_core) :: json
26-
type(json_value),pointer :: p_root,p_array
26+
type(json_value),pointer :: p_root,p_array,p_element
2727
logical(LK) :: is_valid !! True if the structure is valid.
2828
character(kind=CK,len=:),allocatable :: error_msg !! error message from `validate`
2929
integer :: i !! counter
@@ -47,12 +47,11 @@ subroutine test_35(error_cnt)
4747
call json%add(p_root,p_array)
4848
call json%add(p_root,p_array) ! this creates a malformed JSON structure
4949
elseif (i==2) then
50-
call json%create_array(p_array, '')
51-
call json%create_object(p_root, 'object')
52-
call json%add(p_root,'int',1_IK)
53-
call json%add(p_array,p_root)
54-
call json%add(p_array,p_root) ! this creates a malformed JSON structure
55-
! note: below we will destroy p_root, which is the duplicate array element
50+
call json%create_array(p_root, '')
51+
call json%create_object(p_element, 'object')
52+
call json%add(p_element,'int',1_IK)
53+
call json%add(p_root,p_element)
54+
call json%add(p_root,p_element) ! this creates a malformed JSON structure
5655
end if
5756

5857
! test initialize_json_core:

0 commit comments

Comments
 (0)