fix memory leak

Found by Lsan. Upstreamed Libreoffice patch.
fix indentation
fix memory leak

Found by Lsan. Upstreamed Libreoffice patch.
Merge pull request #296 from mmohrhard/master

fix memory leak