Fix buffer-smashing bug in loadAndRetain()

For details, see the commit message
https://github.com/stebulus/aalto-xml/commit/12ef1d3bfb1b4631b4d79962e792a09921125179