Fix a crash bug when timeout happens in curl