Fix memory leaks in GeoModeXml
Valgrind reports many leaks in GeoModelXml
due to explicit strings being passed to XMLString:::transcode
within function calls, which creates an XMLCh
which needs to be released but currently are not. This MR updates all such instances to instead define a temporary XMLCh *
variable which gets passed instead, and is then released once it is no longer needed.
In future it may be better to provide a wrapper function, which cleans up behind-the-scenes, to replace all explicit calls to XMLString:::transcode
in GeoModelXml
.
Before:
==5157== definitely lost: 54,460,276 bytes in 3,964,688 blocks
After:
==42833== definitely lost: 1,185,328 bytes in 105,116 blocks
Edited by Nicholas Styles