Skip to content

Commit b41abbb

Browse files
Merge pull request #423 from jacobwilliams/422-dangling-pointer
fixed a dangling pointer in test 10. Fixes #422
2 parents b2c0b17 + 96770c1 commit b41abbb

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/tests/jf_test_10.F90

+5-3
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,10 @@ subroutine test_10(error_cnt)
313313
end if
314314
end if
315315

316+
nullify(p) ! p is just a pointer to f2
317+
316318
write(error_unit,'(A)') 'json_create...'
317-
write(error_unit,'(A)') 'json_create_logical...'; call json%destroy(p); call json%create_logical(p,.true.,'foo')
319+
write(error_unit,'(A)') 'json_create_logical...'; call json%create_logical(p,.true.,'foo')
318320
write(error_unit,'(A)') 'json_create_integer...'; call json%destroy(p); call json%create_integer(p,1000_IK,'foo')
319321
write(error_unit,'(A)') 'json_create_real ...'; call json%destroy(p); call json%create_real (p,9.0_wp,'foo')
320322
write(error_unit,'(A)') 'json_create_string ...'; call json%destroy(p); call json%create_string (p,'foo','bar')
@@ -330,8 +332,8 @@ subroutine test_10(error_cnt)
330332
!--------------------------------
331333

332334
!cleanup:
333-
!call f%destroy() !WARNING: causing "pointer being freed was not allocated" errors.... need to investigate
334-
!call f2%destroy()
335+
call f%destroy()
336+
call f2%destroy()
335337

336338
end subroutine test_10
337339

0 commit comments

Comments
 (0)