send_http_request(): Prevent memory leaks when handling errors