Skip to content

Commit

Permalink
Make sure we start off with null() temp vstrings
Browse files Browse the repository at this point in the history
See issue #31. This should avoid the reported crash,
but the tests I've tried don't trip the segfault.
But anyway, add two tests for sax with double
parsing.
  • Loading branch information
andreww committed Sep 13, 2013
1 parent 8f1e4c0 commit f58d44d
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 0 deletions.
1 change: 1 addition & 0 deletions sax/m_sax_parser.F90
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ end subroutine startEntity_handler
nullURI => null()
#endif
tempString => null()
tempString2 => null()
elem => null()
attDecl => null()

Expand Down
24 changes: 24 additions & 0 deletions sax/test/test_sax_parser_4.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
program test_sax_reader

use FoX_sax
type(xml_t) :: xp
integer :: iostat

! Can we parse the same file twice?

call open_xml_file(xp, "test_sax_fsm_1.in", iostat)

write(*,'(i1)') iostat

call parse(xp)

call close_xml_t(xp)

call open_xml_file(xp, "test_sax_fsm_1.in", iostat)

write(*,'(i1)') iostat

call parse(xp)

call close_xml_t(xp)
end program test_sax_reader
2 changes: 2 additions & 0 deletions sax/test/test_sax_parser_4.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
0
0
18 changes: 18 additions & 0 deletions sax/test/test_sax_parser_5.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
program test_sax_reader

use FoX_sax
type(xml_t) :: xp
integer :: iostat

! Can we parse the same file twice?

call open_xml_file(xp, "testin.xml", iostat)

write(*,'(i1)') iostat

call parse(xp)

call parse(xp)

call close_xml_t(xp)
end program test_sax_reader
1 change: 1 addition & 0 deletions sax/test/test_sax_parser_5.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0

0 comments on commit f58d44d

Please sign in to comment.