logger: fix memory leak