fix memory leak in log