Companion memory leaks fixed

Been running companion under valgrind for a couple of past days. Qt has massive problems with memory, it's libraries alone produce around 1000 warnings/errors in valgrind.

Anyway, I managed to sift trough that and found a couple of actual application memory leaks and fixed them. I have tested this and haven't noticed that I killed some aspect of companion. But somebody should check this before merge.