Fixes for memory leaks.

Signed-off-by: Michel Verbraak <michel@1st-setup.nl>