beware of memory leaks because of threads

Signed-off-by: Lehner Florian <dev@der-flo.net>