free buffer before next overwrite
fix memory leaks in loadImage() and saveImage()
Merge branch 'find_memleak' of https://github.com/ccaccb/unpaper into find_memleak