Apache FOP Code fix

Code fix
by
JM
:

Fixed two memory-leaks in image handling. The image cache is finally working
properly.