fix memory leaks during connection timeouts